fernandes-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +392 -0
- data/Rakefile +6 -0
- data/app/assets/javascripts/ui.esm.js +14385 -0
- data/app/assets/javascripts/ui.js +13990 -0
- data/app/assets/stylesheets/ui/application.css +584 -0
- data/app/assets/stylesheets/ui/sonner.css +610 -0
- data/app/behaviors/ui/accordion_behavior.rb +30 -0
- data/app/behaviors/ui/accordion_content_behavior.rb +72 -0
- data/app/behaviors/ui/accordion_item_behavior.rb +47 -0
- data/app/behaviors/ui/accordion_trigger_behavior.rb +79 -0
- data/app/behaviors/ui/alert_behavior.rb +44 -0
- data/app/behaviors/ui/alert_description_behavior.rb +32 -0
- data/app/behaviors/ui/alert_dialog_action_behavior.rb +27 -0
- data/app/behaviors/ui/alert_dialog_behavior.rb +41 -0
- data/app/behaviors/ui/alert_dialog_cancel_behavior.rb +27 -0
- data/app/behaviors/ui/alert_dialog_content_behavior.rb +42 -0
- data/app/behaviors/ui/alert_dialog_description_behavior.rb +25 -0
- data/app/behaviors/ui/alert_dialog_footer_behavior.rb +26 -0
- data/app/behaviors/ui/alert_dialog_header_behavior.rb +25 -0
- data/app/behaviors/ui/alert_dialog_overlay_behavior.rb +68 -0
- data/app/behaviors/ui/alert_dialog_title_behavior.rb +25 -0
- data/app/behaviors/ui/alert_dialog_trigger_behavior.rb +39 -0
- data/app/behaviors/ui/alert_title_behavior.rb +32 -0
- data/app/behaviors/ui/aspect_ratio_behavior.rb +47 -0
- data/app/behaviors/ui/avatar_behavior.rb +43 -0
- data/app/behaviors/ui/avatar_fallback_behavior.rb +43 -0
- data/app/behaviors/ui/avatar_image_behavior.rb +46 -0
- data/app/behaviors/ui/badge_behavior.rb +50 -0
- data/app/behaviors/ui/blockquote_behavior.rb +23 -0
- data/app/behaviors/ui/breadcrumb_behavior.rb +22 -0
- data/app/behaviors/ui/breadcrumb_ellipsis_behavior.rb +34 -0
- data/app/behaviors/ui/breadcrumb_item_behavior.rb +32 -0
- data/app/behaviors/ui/breadcrumb_link_behavior.rb +33 -0
- data/app/behaviors/ui/breadcrumb_list_behavior.rb +32 -0
- data/app/behaviors/ui/breadcrumb_page_behavior.rb +35 -0
- data/app/behaviors/ui/breadcrumb_separator_behavior.rb +34 -0
- data/app/behaviors/ui/button_behavior.rb +99 -0
- data/app/behaviors/ui/button_group_behavior.rb +55 -0
- data/app/behaviors/ui/button_group_separator_behavior.rb +33 -0
- data/app/behaviors/ui/button_group_text_behavior.rb +34 -0
- data/app/behaviors/ui/calendar_behavior.rb +119 -0
- data/app/behaviors/ui/card_action_behavior.rb +32 -0
- data/app/behaviors/ui/card_behavior.rb +32 -0
- data/app/behaviors/ui/card_content_behavior.rb +32 -0
- data/app/behaviors/ui/card_description_behavior.rb +32 -0
- data/app/behaviors/ui/card_footer_behavior.rb +32 -0
- data/app/behaviors/ui/card_header_behavior.rb +32 -0
- data/app/behaviors/ui/card_title_behavior.rb +32 -0
- data/app/behaviors/ui/carousel_behavior.rb +53 -0
- data/app/behaviors/ui/carousel_content_behavior.rb +65 -0
- data/app/behaviors/ui/carousel_item_behavior.rb +26 -0
- data/app/behaviors/ui/carousel_next_behavior.rb +39 -0
- data/app/behaviors/ui/carousel_previous_behavior.rb +39 -0
- data/app/behaviors/ui/checkbox_behavior.rb +48 -0
- data/app/behaviors/ui/collapsible_behavior.rb +42 -0
- data/app/behaviors/ui/collapsible_content_behavior.rb +39 -0
- data/app/behaviors/ui/collapsible_trigger_behavior.rb +55 -0
- data/app/behaviors/ui/combobox_behavior.rb +0 -0
- data/app/behaviors/ui/command_behavior.rb +37 -0
- data/app/behaviors/ui/command_dialog_behavior.rb +30 -0
- data/app/behaviors/ui/command_empty_behavior.rb +36 -0
- data/app/behaviors/ui/command_group_behavior.rb +43 -0
- data/app/behaviors/ui/command_input_behavior.rb +49 -0
- data/app/behaviors/ui/command_item_behavior.rb +47 -0
- data/app/behaviors/ui/command_list_behavior.rb +38 -0
- data/app/behaviors/ui/command_separator_behavior.rb +30 -0
- data/app/behaviors/ui/command_shortcut_behavior.rb +29 -0
- data/app/behaviors/ui/context_menu_behavior.rb +32 -0
- data/app/behaviors/ui/context_menu_checkbox_item_behavior.rb +38 -0
- data/app/behaviors/ui/context_menu_content_behavior.rb +37 -0
- data/app/behaviors/ui/context_menu_item_behavior.rb +40 -0
- data/app/behaviors/ui/context_menu_label_behavior.rb +33 -0
- data/app/behaviors/ui/context_menu_radio_group_behavior.rb +20 -0
- data/app/behaviors/ui/context_menu_radio_item_behavior.rb +38 -0
- data/app/behaviors/ui/context_menu_separator_behavior.rb +22 -0
- data/app/behaviors/ui/context_menu_shortcut_behavior.rb +21 -0
- data/app/behaviors/ui/context_menu_trigger_behavior.rb +32 -0
- data/app/behaviors/ui/date_picker_behavior.rb +90 -0
- data/app/behaviors/ui/date_picker_input_behavior.rb +62 -0
- data/app/behaviors/ui/date_picker_trigger_behavior.rb +62 -0
- data/app/behaviors/ui/dialog_behavior.rb +46 -0
- data/app/behaviors/ui/dialog_content_behavior.rb +46 -0
- data/app/behaviors/ui/dialog_footer_behavior.rb +26 -0
- data/app/behaviors/ui/dialog_header_behavior.rb +26 -0
- data/app/behaviors/ui/dialog_overlay_behavior.rb +69 -0
- data/app/behaviors/ui/drawer_behavior.rb +57 -0
- data/app/behaviors/ui/drawer_close_behavior.rb +10 -0
- data/app/behaviors/ui/drawer_content_behavior.rb +107 -0
- data/app/behaviors/ui/drawer_description_behavior.rb +23 -0
- data/app/behaviors/ui/drawer_footer_behavior.rb +23 -0
- data/app/behaviors/ui/drawer_handle_behavior.rb +40 -0
- data/app/behaviors/ui/drawer_header_behavior.rb +29 -0
- data/app/behaviors/ui/drawer_overlay_behavior.rb +75 -0
- data/app/behaviors/ui/drawer_title_behavior.rb +26 -0
- data/app/behaviors/ui/drawer_trigger_behavior.rb +18 -0
- data/app/behaviors/ui/dropdown_menu_behavior.rb +43 -0
- data/app/behaviors/ui/dropdown_menu_checkbox_item_behavior.rb +46 -0
- data/app/behaviors/ui/dropdown_menu_content_behavior.rb +37 -0
- data/app/behaviors/ui/dropdown_menu_item_behavior.rb +40 -0
- data/app/behaviors/ui/dropdown_menu_label_behavior.rb +30 -0
- data/app/behaviors/ui/dropdown_menu_radio_group_behavior.rb +20 -0
- data/app/behaviors/ui/dropdown_menu_radio_item_behavior.rb +46 -0
- data/app/behaviors/ui/dropdown_menu_separator_behavior.rb +23 -0
- data/app/behaviors/ui/dropdown_menu_shortcut_behavior.rb +21 -0
- data/app/behaviors/ui/dropdown_menu_sub_behavior.rb +21 -0
- data/app/behaviors/ui/dropdown_menu_sub_content_behavior.rb +38 -0
- data/app/behaviors/ui/dropdown_menu_sub_trigger_behavior.rb +35 -0
- data/app/behaviors/ui/dropdown_menu_trigger_behavior.rb +46 -0
- data/app/behaviors/ui/empty_behavior.rb +124 -0
- data/app/behaviors/ui/field_behavior.rb +46 -0
- data/app/behaviors/ui/field_content_behavior.rb +26 -0
- data/app/behaviors/ui/field_description_behavior.rb +26 -0
- data/app/behaviors/ui/field_error_behavior.rb +47 -0
- data/app/behaviors/ui/field_group_behavior.rb +26 -0
- data/app/behaviors/ui/field_label_behavior.rb +27 -0
- data/app/behaviors/ui/field_legend_behavior.rb +28 -0
- data/app/behaviors/ui/field_separator_behavior.rb +33 -0
- data/app/behaviors/ui/field_set_behavior.rb +26 -0
- data/app/behaviors/ui/field_title_behavior.rb +26 -0
- data/app/behaviors/ui/h1_behavior.rb +23 -0
- data/app/behaviors/ui/h2_behavior.rb +23 -0
- data/app/behaviors/ui/h3_behavior.rb +23 -0
- data/app/behaviors/ui/h4_behavior.rb +23 -0
- data/app/behaviors/ui/hover_card_behavior.rb +29 -0
- data/app/behaviors/ui/hover_card_content_behavior.rb +41 -0
- data/app/behaviors/ui/hover_card_trigger_behavior.rb +44 -0
- data/app/behaviors/ui/inline_code_behavior.rb +23 -0
- data/app/behaviors/ui/input_behavior.rb +52 -0
- data/app/behaviors/ui/input_group_addon_behavior.rb +52 -0
- data/app/behaviors/ui/input_group_behavior.rb +63 -0
- data/app/behaviors/ui/input_group_button_behavior.rb +82 -0
- data/app/behaviors/ui/input_group_input_behavior.rb +50 -0
- data/app/behaviors/ui/input_group_text_behavior.rb +32 -0
- data/app/behaviors/ui/input_group_textarea_behavior.rb +50 -0
- data/app/behaviors/ui/input_otp_behavior.rb +44 -0
- data/app/behaviors/ui/input_otp_group_behavior.rb +32 -0
- data/app/behaviors/ui/input_otp_separator_behavior.rb +33 -0
- data/app/behaviors/ui/input_otp_slot_behavior.rb +49 -0
- data/app/behaviors/ui/item_actions_behavior.rb +31 -0
- data/app/behaviors/ui/item_behavior.rb +100 -0
- data/app/behaviors/ui/item_content_behavior.rb +31 -0
- data/app/behaviors/ui/item_description_behavior.rb +31 -0
- data/app/behaviors/ui/item_footer_behavior.rb +31 -0
- data/app/behaviors/ui/item_group_behavior.rb +31 -0
- data/app/behaviors/ui/item_header_behavior.rb +31 -0
- data/app/behaviors/ui/item_media_behavior.rb +47 -0
- data/app/behaviors/ui/item_separator_behavior.rb +31 -0
- data/app/behaviors/ui/item_title_behavior.rb +31 -0
- data/app/behaviors/ui/kbd_behavior.rb +28 -0
- data/app/behaviors/ui/kbd_group_behavior.rb +26 -0
- data/app/behaviors/ui/label_behavior.rb +35 -0
- data/app/behaviors/ui/large_behavior.rb +23 -0
- data/app/behaviors/ui/lead_behavior.rb +23 -0
- data/app/behaviors/ui/list_behavior.rb +23 -0
- data/app/behaviors/ui/menubar_behavior.rb +43 -0
- data/app/behaviors/ui/menubar_checkbox_item_behavior.rb +56 -0
- data/app/behaviors/ui/menubar_content_behavior.rb +53 -0
- data/app/behaviors/ui/menubar_item_behavior.rb +78 -0
- data/app/behaviors/ui/menubar_label_behavior.rb +41 -0
- data/app/behaviors/ui/menubar_menu_behavior.rb +39 -0
- data/app/behaviors/ui/menubar_radio_group_behavior.rb +34 -0
- data/app/behaviors/ui/menubar_radio_item_behavior.rb +61 -0
- data/app/behaviors/ui/menubar_separator_behavior.rb +30 -0
- data/app/behaviors/ui/menubar_shortcut_behavior.rb +29 -0
- data/app/behaviors/ui/menubar_sub_behavior.rb +30 -0
- data/app/behaviors/ui/menubar_sub_content_behavior.rb +49 -0
- data/app/behaviors/ui/menubar_sub_trigger_behavior.rb +57 -0
- data/app/behaviors/ui/menubar_trigger_behavior.rb +48 -0
- data/app/behaviors/ui/muted_behavior.rb +23 -0
- data/app/behaviors/ui/navigation_menu_behavior.rb +42 -0
- data/app/behaviors/ui/navigation_menu_content_behavior.rb +65 -0
- data/app/behaviors/ui/navigation_menu_item_behavior.rb +38 -0
- data/app/behaviors/ui/navigation_menu_link_behavior.rb +68 -0
- data/app/behaviors/ui/navigation_menu_list_behavior.rb +33 -0
- data/app/behaviors/ui/navigation_menu_trigger_behavior.rb +57 -0
- data/app/behaviors/ui/navigation_menu_viewport_behavior.rb +61 -0
- data/app/behaviors/ui/p_behavior.rb +23 -0
- data/app/behaviors/ui/pagination_behavior.rb +26 -0
- data/app/behaviors/ui/pagination_content_behavior.rb +24 -0
- data/app/behaviors/ui/pagination_ellipsis_behavior.rb +25 -0
- data/app/behaviors/ui/pagination_item_behavior.rb +13 -0
- data/app/behaviors/ui/pagination_link_behavior.rb +57 -0
- data/app/behaviors/ui/pagination_next_behavior.rb +20 -0
- data/app/behaviors/ui/pagination_previous_behavior.rb +20 -0
- data/app/behaviors/ui/popover_behavior.rb +54 -0
- data/app/behaviors/ui/popover_content_behavior.rb +52 -0
- data/app/behaviors/ui/popover_trigger_behavior.rb +33 -0
- data/app/behaviors/ui/progress_behavior.rb +48 -0
- data/app/behaviors/ui/radio_button_behavior.rb +46 -0
- data/app/behaviors/ui/resizable_handle_behavior.rb +81 -0
- data/app/behaviors/ui/resizable_panel_behavior.rb +53 -0
- data/app/behaviors/ui/resizable_panel_group_behavior.rb +41 -0
- data/app/behaviors/ui/responsive_dialog_behavior.rb +41 -0
- data/app/behaviors/ui/scroll_area_behavior.rb +36 -0
- data/app/behaviors/ui/scroll_area_corner_behavior.rb +34 -0
- data/app/behaviors/ui/scroll_area_scrollbar_behavior.rb +50 -0
- data/app/behaviors/ui/scroll_area_thumb_behavior.rb +34 -0
- data/app/behaviors/ui/scroll_area_viewport_behavior.rb +36 -0
- data/app/behaviors/ui/select_behavior.rb +84 -0
- data/app/behaviors/ui/select_content_behavior.rb +42 -0
- data/app/behaviors/ui/select_group_behavior.rb +35 -0
- data/app/behaviors/ui/select_item_behavior.rb +48 -0
- data/app/behaviors/ui/select_label_behavior.rb +34 -0
- data/app/behaviors/ui/select_scroll_down_button_behavior.rb +51 -0
- data/app/behaviors/ui/select_scroll_up_button_behavior.rb +51 -0
- data/app/behaviors/ui/select_trigger_behavior.rb +40 -0
- data/app/behaviors/ui/separator_behavior.rb +58 -0
- data/app/behaviors/ui/shared_as_child_behavior.rb +71 -0
- data/app/behaviors/ui/sheet_behavior.rb +46 -0
- data/app/behaviors/ui/sheet_content_behavior.rb +92 -0
- data/app/behaviors/ui/sheet_footer_behavior.rb +27 -0
- data/app/behaviors/ui/sheet_header_behavior.rb +27 -0
- data/app/behaviors/ui/sheet_overlay_behavior.rb +76 -0
- data/app/behaviors/ui/sidebar_behavior.rb +88 -0
- data/app/behaviors/ui/sidebar_content_behavior.rb +36 -0
- data/app/behaviors/ui/sidebar_footer_behavior.rb +35 -0
- data/app/behaviors/ui/sidebar_group_action_behavior.rb +40 -0
- data/app/behaviors/ui/sidebar_group_behavior.rb +35 -0
- data/app/behaviors/ui/sidebar_group_content_behavior.rb +35 -0
- data/app/behaviors/ui/sidebar_group_label_behavior.rb +39 -0
- data/app/behaviors/ui/sidebar_header_behavior.rb +35 -0
- data/app/behaviors/ui/sidebar_input_behavior.rb +36 -0
- data/app/behaviors/ui/sidebar_inset_behavior.rb +39 -0
- data/app/behaviors/ui/sidebar_menu_action_behavior.rb +49 -0
- data/app/behaviors/ui/sidebar_menu_badge_behavior.rb +39 -0
- data/app/behaviors/ui/sidebar_menu_behavior.rb +35 -0
- data/app/behaviors/ui/sidebar_menu_button_behavior.rb +70 -0
- data/app/behaviors/ui/sidebar_menu_item_behavior.rb +35 -0
- data/app/behaviors/ui/sidebar_menu_skeleton_behavior.rb +35 -0
- data/app/behaviors/ui/sidebar_menu_sub_behavior.rb +36 -0
- data/app/behaviors/ui/sidebar_menu_sub_button_behavior.rb +59 -0
- data/app/behaviors/ui/sidebar_menu_sub_item_behavior.rb +35 -0
- data/app/behaviors/ui/sidebar_provider_behavior.rb +56 -0
- data/app/behaviors/ui/sidebar_rail_behavior.rb +47 -0
- data/app/behaviors/ui/sidebar_separator_behavior.rb +36 -0
- data/app/behaviors/ui/sidebar_trigger_behavior.rb +40 -0
- data/app/behaviors/ui/slider_behavior.rb +46 -0
- data/app/behaviors/ui/slider_range_behavior.rb +18 -0
- data/app/behaviors/ui/slider_thumb_behavior.rb +25 -0
- data/app/behaviors/ui/slider_track_behavior.rb +23 -0
- data/app/behaviors/ui/small_behavior.rb +23 -0
- data/app/behaviors/ui/sonner_toaster_behavior.rb +34 -0
- data/app/behaviors/ui/spinner_behavior.rb +50 -0
- data/app/behaviors/ui/switch_behavior.rb +68 -0
- data/app/behaviors/ui/table_behavior.rb +28 -0
- data/app/behaviors/ui/table_body_behavior.rb +28 -0
- data/app/behaviors/ui/table_caption_behavior.rb +28 -0
- data/app/behaviors/ui/table_cell_behavior.rb +28 -0
- data/app/behaviors/ui/table_footer_behavior.rb +28 -0
- data/app/behaviors/ui/table_head_behavior.rb +28 -0
- data/app/behaviors/ui/table_header_behavior.rb +28 -0
- data/app/behaviors/ui/table_row_behavior.rb +28 -0
- data/app/behaviors/ui/tabs_behavior.rb +32 -0
- data/app/behaviors/ui/tabs_content_behavior.rb +38 -0
- data/app/behaviors/ui/tabs_list_behavior.rb +20 -0
- data/app/behaviors/ui/tabs_trigger_behavior.rb +47 -0
- data/app/behaviors/ui/textarea_behavior.rb +36 -0
- data/app/behaviors/ui/toggle_behavior.rb +85 -0
- data/app/behaviors/ui/toggle_group_behavior.rb +68 -0
- data/app/behaviors/ui/toggle_group_item_behavior.rb +88 -0
- data/app/behaviors/ui/tooltip_behavior.rb +29 -0
- data/app/behaviors/ui/tooltip_content_behavior.rb +57 -0
- data/app/behaviors/ui/tooltip_trigger_behavior.rb +60 -0
- data/app/components/ui/accordion.rb +36 -0
- data/app/components/ui/accordion_content.rb +30 -0
- data/app/components/ui/accordion_item.rb +48 -0
- data/app/components/ui/accordion_trigger.rb +52 -0
- data/app/components/ui/alert.rb +31 -0
- data/app/components/ui/alert_description.rb +26 -0
- data/app/components/ui/alert_dialog.rb +33 -0
- data/app/components/ui/alert_dialog_action.rb +34 -0
- data/app/components/ui/alert_dialog_cancel.rb +34 -0
- data/app/components/ui/alert_dialog_content.rb +25 -0
- data/app/components/ui/alert_dialog_description.rb +25 -0
- data/app/components/ui/alert_dialog_footer.rb +28 -0
- data/app/components/ui/alert_dialog_header.rb +27 -0
- data/app/components/ui/alert_dialog_overlay.rb +30 -0
- data/app/components/ui/alert_dialog_title.rb +25 -0
- data/app/components/ui/alert_dialog_trigger.rb +27 -0
- data/app/components/ui/alert_title.rb +24 -0
- data/app/components/ui/aspect_ratio.rb +32 -0
- data/app/components/ui/avatar.rb +31 -0
- data/app/components/ui/avatar_fallback.rb +33 -0
- data/app/components/ui/avatar_image.rb +33 -0
- data/app/components/ui/badge.rb +37 -0
- data/app/components/ui/blockquote.rb +15 -0
- data/app/components/ui/breadcrumb.rb +31 -0
- data/app/components/ui/breadcrumb_ellipsis.rb +55 -0
- data/app/components/ui/breadcrumb_item.rb +27 -0
- data/app/components/ui/breadcrumb_link.rb +27 -0
- data/app/components/ui/breadcrumb_list.rb +27 -0
- data/app/components/ui/breadcrumb_page.rb +25 -0
- data/app/components/ui/breadcrumb_separator.rb +51 -0
- data/app/components/ui/button.rb +52 -0
- data/app/components/ui/button_group.rb +48 -0
- data/app/components/ui/button_group_separator.rb +32 -0
- data/app/components/ui/button_group_text.rb +45 -0
- data/app/components/ui/calendar.rb +209 -0
- data/app/components/ui/card.rb +14 -0
- data/app/components/ui/card_action.rb +14 -0
- data/app/components/ui/card_content.rb +14 -0
- data/app/components/ui/card_description.rb +14 -0
- data/app/components/ui/card_footer.rb +14 -0
- data/app/components/ui/card_header.rb +14 -0
- data/app/components/ui/card_title.rb +14 -0
- data/app/components/ui/carousel.rb +16 -0
- data/app/components/ui/carousel_content.rb +15 -0
- data/app/components/ui/carousel_item.rb +13 -0
- data/app/components/ui/carousel_next.rb +29 -0
- data/app/components/ui/carousel_previous.rb +29 -0
- data/app/components/ui/checkbox.rb +49 -0
- data/app/components/ui/collapsible.rb +23 -0
- data/app/components/ui/collapsible_content.rb +15 -0
- data/app/components/ui/collapsible_trigger.rb +21 -0
- data/app/components/ui/combobox_wrapper.rb +57 -0
- data/app/components/ui/command.rb +15 -0
- data/app/components/ui/command_dialog.rb +25 -0
- data/app/components/ui/command_empty.rb +14 -0
- data/app/components/ui/command_group.rb +21 -0
- data/app/components/ui/command_input.rb +32 -0
- data/app/components/ui/command_item.rb +16 -0
- data/app/components/ui/command_list.rb +14 -0
- data/app/components/ui/command_separator.rb +14 -0
- data/app/components/ui/command_shortcut.rb +14 -0
- data/app/components/ui/context_menu.rb +30 -0
- data/app/components/ui/context_menu_checkbox_item.rb +51 -0
- data/app/components/ui/context_menu_content.rb +27 -0
- data/app/components/ui/context_menu_item.rb +40 -0
- data/app/components/ui/context_menu_label.rb +27 -0
- data/app/components/ui/context_menu_radio_group.rb +28 -0
- data/app/components/ui/context_menu_radio_item.rb +51 -0
- data/app/components/ui/context_menu_separator.rb +23 -0
- data/app/components/ui/context_menu_shortcut.rb +25 -0
- data/app/components/ui/context_menu_trigger.rb +27 -0
- data/app/components/ui/date_picker.rb +128 -0
- data/app/components/ui/date_picker_input.rb +75 -0
- data/app/components/ui/date_picker_trigger.rb +74 -0
- data/app/components/ui/dialog.rb +19 -0
- data/app/components/ui/dialog_close.rb +27 -0
- data/app/components/ui/dialog_content.rb +17 -0
- data/app/components/ui/dialog_description.rb +22 -0
- data/app/components/ui/dialog_footer.rb +15 -0
- data/app/components/ui/dialog_header.rb +15 -0
- data/app/components/ui/dialog_overlay.rb +18 -0
- data/app/components/ui/dialog_title.rb +22 -0
- data/app/components/ui/dialog_trigger.rb +38 -0
- data/app/components/ui/drawer.rb +39 -0
- data/app/components/ui/drawer_close.rb +23 -0
- data/app/components/ui/drawer_content.rb +19 -0
- data/app/components/ui/drawer_description.rb +16 -0
- data/app/components/ui/drawer_footer.rb +16 -0
- data/app/components/ui/drawer_handle.rb +14 -0
- data/app/components/ui/drawer_header.rb +16 -0
- data/app/components/ui/drawer_overlay.rb +17 -0
- data/app/components/ui/drawer_title.rb +16 -0
- data/app/components/ui/drawer_trigger.rb +34 -0
- data/app/components/ui/dropdown_menu.rb +56 -0
- data/app/components/ui/dropdown_menu_checkbox_item.rb +55 -0
- data/app/components/ui/dropdown_menu_content.rb +29 -0
- data/app/components/ui/dropdown_menu_item.rb +40 -0
- data/app/components/ui/dropdown_menu_label.rb +27 -0
- data/app/components/ui/dropdown_menu_radio_group.rb +28 -0
- data/app/components/ui/dropdown_menu_radio_item.rb +57 -0
- data/app/components/ui/dropdown_menu_separator.rb +23 -0
- data/app/components/ui/dropdown_menu_shortcut.rb +25 -0
- data/app/components/ui/dropdown_menu_sub.rb +28 -0
- data/app/components/ui/dropdown_menu_sub_content.rb +31 -0
- data/app/components/ui/dropdown_menu_sub_trigger.rb +47 -0
- data/app/components/ui/dropdown_menu_trigger.rb +43 -0
- data/app/components/ui/empty.rb +25 -0
- data/app/components/ui/empty_content.rb +22 -0
- data/app/components/ui/empty_description.rb +20 -0
- data/app/components/ui/empty_header.rb +24 -0
- data/app/components/ui/empty_media.rb +28 -0
- data/app/components/ui/empty_title.rb +20 -0
- data/app/components/ui/field.rb +35 -0
- data/app/components/ui/field_content.rb +25 -0
- data/app/components/ui/field_description.rb +25 -0
- data/app/components/ui/field_error.rb +61 -0
- data/app/components/ui/field_group.rb +28 -0
- data/app/components/ui/field_label.rb +27 -0
- data/app/components/ui/field_legend.rb +30 -0
- data/app/components/ui/field_separator.rb +50 -0
- data/app/components/ui/field_set.rb +27 -0
- data/app/components/ui/field_title.rb +25 -0
- data/app/components/ui/h1.rb +15 -0
- data/app/components/ui/h2.rb +15 -0
- data/app/components/ui/h3.rb +15 -0
- data/app/components/ui/h4.rb +15 -0
- data/app/components/ui/hover_card.rb +26 -0
- data/app/components/ui/hover_card_content.rb +32 -0
- data/app/components/ui/hover_card_trigger.rb +46 -0
- data/app/components/ui/inline_code.rb +15 -0
- data/app/components/ui/input.rb +19 -0
- data/app/components/ui/input_group.rb +33 -0
- data/app/components/ui/input_group_addon.rb +32 -0
- data/app/components/ui/input_group_button.rb +40 -0
- data/app/components/ui/input_group_input.rb +43 -0
- data/app/components/ui/input_group_text.rb +31 -0
- data/app/components/ui/input_group_textarea.rb +43 -0
- data/app/components/ui/input_otp.rb +56 -0
- data/app/components/ui/input_otp_group.rb +25 -0
- data/app/components/ui/input_otp_separator.rb +34 -0
- data/app/components/ui/input_otp_slot.rb +32 -0
- data/app/components/ui/item.rb +26 -0
- data/app/components/ui/item_actions.rb +14 -0
- data/app/components/ui/item_content.rb +14 -0
- data/app/components/ui/item_description.rb +14 -0
- data/app/components/ui/item_footer.rb +14 -0
- data/app/components/ui/item_group.rb +14 -0
- data/app/components/ui/item_header.rb +14 -0
- data/app/components/ui/item_media.rb +15 -0
- data/app/components/ui/item_separator.rb +14 -0
- data/app/components/ui/item_title.rb +14 -0
- data/app/components/ui/kbd.rb +29 -0
- data/app/components/ui/kbd_group.rb +30 -0
- data/app/components/ui/label.rb +30 -0
- data/app/components/ui/large.rb +15 -0
- data/app/components/ui/lead.rb +15 -0
- data/app/components/ui/list.rb +15 -0
- data/app/components/ui/menubar.rb +36 -0
- data/app/components/ui/menubar_checkbox_item.rb +54 -0
- data/app/components/ui/menubar_content.rb +32 -0
- data/app/components/ui/menubar_item.rb +39 -0
- data/app/components/ui/menubar_label.rb +29 -0
- data/app/components/ui/menubar_menu.rb +29 -0
- data/app/components/ui/menubar_radio_group.rb +29 -0
- data/app/components/ui/menubar_radio_item.rb +56 -0
- data/app/components/ui/menubar_separator.rb +22 -0
- data/app/components/ui/menubar_shortcut.rb +27 -0
- data/app/components/ui/menubar_sub.rb +30 -0
- data/app/components/ui/menubar_sub_content.rb +27 -0
- data/app/components/ui/menubar_sub_trigger.rb +48 -0
- data/app/components/ui/menubar_trigger.rb +26 -0
- data/app/components/ui/muted.rb +15 -0
- data/app/components/ui/navigation_menu.rb +50 -0
- data/app/components/ui/navigation_menu_content.rb +33 -0
- data/app/components/ui/navigation_menu_item.rb +36 -0
- data/app/components/ui/navigation_menu_link.rb +70 -0
- data/app/components/ui/navigation_menu_list.rb +28 -0
- data/app/components/ui/navigation_menu_trigger.rb +51 -0
- data/app/components/ui/navigation_menu_viewport.rb +25 -0
- data/app/components/ui/p.rb +15 -0
- data/app/components/ui/pagination.rb +19 -0
- data/app/components/ui/pagination_content.rb +19 -0
- data/app/components/ui/pagination_ellipsis.rb +26 -0
- data/app/components/ui/pagination_item.rb +17 -0
- data/app/components/ui/pagination_link.rb +25 -0
- data/app/components/ui/pagination_next.rb +31 -0
- data/app/components/ui/pagination_previous.rb +31 -0
- data/app/components/ui/popover.rb +48 -0
- data/app/components/ui/popover_content.rb +29 -0
- data/app/components/ui/popover_trigger.rb +36 -0
- data/app/components/ui/progress.rb +37 -0
- data/app/components/ui/radio_button.rb +50 -0
- data/app/components/ui/resizable_handle.rb +58 -0
- data/app/components/ui/resizable_panel.rb +35 -0
- data/app/components/ui/resizable_panel_group.rb +41 -0
- data/app/components/ui/responsive_dialog.rb +98 -0
- data/app/components/ui/scroll_area.rb +62 -0
- data/app/components/ui/scroll_area_corner.rb +33 -0
- data/app/components/ui/scroll_area_scrollbar.rb +45 -0
- data/app/components/ui/scroll_area_thumb.rb +38 -0
- data/app/components/ui/scroll_area_viewport.rb +41 -0
- data/app/components/ui/select.rb +42 -0
- data/app/components/ui/select_content.rb +43 -0
- data/app/components/ui/select_group.rb +38 -0
- data/app/components/ui/select_item.rb +67 -0
- data/app/components/ui/select_label.rb +34 -0
- data/app/components/ui/select_scroll_down_button.rb +47 -0
- data/app/components/ui/select_scroll_up_button.rb +47 -0
- data/app/components/ui/select_trigger.rb +45 -0
- data/app/components/ui/separator.rb +39 -0
- data/app/components/ui/sheet.rb +19 -0
- data/app/components/ui/sheet_close.rb +39 -0
- data/app/components/ui/sheet_content.rb +55 -0
- data/app/components/ui/sheet_description.rb +22 -0
- data/app/components/ui/sheet_footer.rb +15 -0
- data/app/components/ui/sheet_header.rb +15 -0
- data/app/components/ui/sheet_overlay.rb +18 -0
- data/app/components/ui/sheet_title.rb +22 -0
- data/app/components/ui/sheet_trigger.rb +27 -0
- data/app/components/ui/sidebar.rb +100 -0
- data/app/components/ui/sidebar_content.rb +34 -0
- data/app/components/ui/sidebar_footer.rb +36 -0
- data/app/components/ui/sidebar_group.rb +52 -0
- data/app/components/ui/sidebar_group_action.rb +47 -0
- data/app/components/ui/sidebar_group_content.rb +42 -0
- data/app/components/ui/sidebar_group_label.rb +46 -0
- data/app/components/ui/sidebar_header.rb +36 -0
- data/app/components/ui/sidebar_input.rb +42 -0
- data/app/components/ui/sidebar_inset.rb +42 -0
- data/app/components/ui/sidebar_menu.rb +39 -0
- data/app/components/ui/sidebar_menu_action.rb +60 -0
- data/app/components/ui/sidebar_menu_badge.rb +39 -0
- data/app/components/ui/sidebar_menu_button.rb +71 -0
- data/app/components/ui/sidebar_menu_item.rb +45 -0
- data/app/components/ui/sidebar_menu_skeleton.rb +63 -0
- data/app/components/ui/sidebar_menu_sub.rb +50 -0
- data/app/components/ui/sidebar_menu_sub_button.rb +48 -0
- data/app/components/ui/sidebar_menu_sub_item.rb +34 -0
- data/app/components/ui/sidebar_provider.rb +73 -0
- data/app/components/ui/sidebar_rail.rb +35 -0
- data/app/components/ui/sidebar_separator.rb +32 -0
- data/app/components/ui/sidebar_trigger.rb +57 -0
- data/app/components/ui/skeleton.rb +42 -0
- data/app/components/ui/small.rb +15 -0
- data/app/components/ui/sonner_toaster.rb +53 -0
- data/app/components/ui/spinner.rb +41 -0
- data/app/components/ui/switch.rb +70 -0
- data/app/components/ui/table.rb +45 -0
- data/app/components/ui/table_body.rb +29 -0
- data/app/components/ui/table_caption.rb +16 -0
- data/app/components/ui/table_cell.rb +16 -0
- data/app/components/ui/table_footer.rb +29 -0
- data/app/components/ui/table_head.rb +16 -0
- data/app/components/ui/table_header.rb +29 -0
- data/app/components/ui/table_row.rb +25 -0
- data/app/components/ui/tabs.rb +40 -0
- data/app/components/ui/tabs_content.rb +30 -0
- data/app/components/ui/tabs_list.rb +27 -0
- data/app/components/ui/tabs_trigger.rb +33 -0
- data/app/components/ui/textarea.rb +19 -0
- data/app/components/ui/toggle.rb +43 -0
- data/app/components/ui/toggle_group.rb +58 -0
- data/app/components/ui/toggle_group_item.rb +71 -0
- data/app/components/ui/tooltip.rb +31 -0
- data/app/components/ui/tooltip_content.rb +35 -0
- data/app/components/ui/tooltip_trigger.rb +42 -0
- data/app/controllers/ui/application_controller.rb +4 -0
- data/app/helpers/ui/application_helper.rb +20 -0
- data/app/helpers/ui/combobox_behavior.rb +59 -0
- data/app/helpers/ui/empty_behavior.rb +124 -0
- data/app/helpers/ui/input_group_addon_behavior.rb +52 -0
- data/app/helpers/ui/input_group_behavior.rb +63 -0
- data/app/helpers/ui/input_group_button_behavior.rb +82 -0
- data/app/helpers/ui/input_group_input_behavior.rb +50 -0
- data/app/helpers/ui/input_group_text_behavior.rb +32 -0
- data/app/helpers/ui/input_group_textarea_behavior.rb +50 -0
- data/app/helpers/ui/popover_behavior.rb +54 -0
- data/app/helpers/ui/popover_content_behavior.rb +52 -0
- data/app/helpers/ui/popover_trigger_behavior.rb +33 -0
- data/app/helpers/ui/scroll_area_behavior.rb +36 -0
- data/app/helpers/ui/scroll_area_corner_behavior.rb +34 -0
- data/app/helpers/ui/scroll_area_scrollbar_behavior.rb +50 -0
- data/app/helpers/ui/scroll_area_thumb_behavior.rb +34 -0
- data/app/helpers/ui/scroll_area_viewport_behavior.rb +36 -0
- data/app/helpers/ui/select_behavior.rb +84 -0
- data/app/helpers/ui/select_content_behavior.rb +42 -0
- data/app/helpers/ui/select_group_behavior.rb +35 -0
- data/app/helpers/ui/select_item_behavior.rb +48 -0
- data/app/helpers/ui/select_label_behavior.rb +34 -0
- data/app/helpers/ui/select_scroll_down_button_behavior.rb +51 -0
- data/app/helpers/ui/select_scroll_up_button_behavior.rb +51 -0
- data/app/helpers/ui/select_trigger_behavior.rb +40 -0
- data/app/helpers/ui/spinner_behavior.rb +50 -0
- data/app/helpers/ui/textarea_behavior.rb +36 -0
- data/app/javascript/ui/common.js +24 -0
- data/app/javascript/ui/controllers/accordion_controller.js +159 -0
- data/app/javascript/ui/controllers/alert_dialog_controller.js +98 -0
- data/app/javascript/ui/controllers/avatar_controller.js +84 -0
- data/app/javascript/ui/controllers/calendar_controller.js +867 -0
- data/app/javascript/ui/controllers/carousel_controller.js +191 -0
- data/app/javascript/ui/controllers/checkbox_controller.js +27 -0
- data/app/javascript/ui/controllers/collapsible_controller.js +65 -0
- data/app/javascript/ui/controllers/combobox_controller.js +149 -0
- data/app/javascript/ui/controllers/command_controller.js +199 -0
- data/app/javascript/ui/controllers/command_dialog_controller.js +100 -0
- data/app/javascript/ui/controllers/context_menu_controller.js +289 -0
- data/app/javascript/ui/controllers/datepicker_controller.js +385 -0
- data/app/javascript/ui/controllers/dialog_controller.js +136 -0
- data/app/javascript/ui/controllers/drawer_controller.js +945 -0
- data/app/javascript/ui/controllers/dropdown_controller.js +850 -0
- data/app/javascript/ui/controllers/hello_controller.js +30 -0
- data/app/javascript/ui/controllers/hover_card_controller.js +147 -0
- data/app/javascript/ui/controllers/input_otp_controller.js +139 -0
- data/app/javascript/ui/controllers/menubar_controller.js +799 -0
- data/app/javascript/ui/controllers/navigation_menu_controller.js +527 -0
- data/app/javascript/ui/controllers/popover_controller.js +257 -0
- data/app/javascript/ui/controllers/resizable_controller.js +449 -0
- data/app/javascript/ui/controllers/responsive_dialog_controller.js +156 -0
- data/app/javascript/ui/controllers/scroll_area_controller.js +623 -0
- data/app/javascript/ui/controllers/select_controller.js +456 -0
- data/app/javascript/ui/controllers/sidebar_controller.js +284 -0
- data/app/javascript/ui/controllers/slider_controller.js +342 -0
- data/app/javascript/ui/controllers/sonner_controller.js +393 -0
- data/app/javascript/ui/controllers/switch_controller.js +75 -0
- data/app/javascript/ui/controllers/tabs_controller.js +156 -0
- data/app/javascript/ui/controllers/toggle_controller.js +49 -0
- data/app/javascript/ui/controllers/toggle_group_controller.js +155 -0
- data/app/javascript/ui/controllers/tooltip_controller.js +122 -0
- data/app/javascript/ui/index.js +94 -0
- data/app/javascript/ui/utils/click-outside-manager.js +133 -0
- data/app/javascript/ui/utils/escape-key-manager.js +118 -0
- data/app/javascript/ui/utils/floating-ui-positioner.js +282 -0
- data/app/javascript/ui/utils/focus-trap-manager.js +238 -0
- data/app/javascript/ui/utils/index.js +86 -0
- data/app/javascript/ui/utils/menu_utils.js +423 -0
- data/app/javascript/ui/utils/scroll-lock-manager.js +149 -0
- data/app/javascript/ui/utils/state-manager.js +205 -0
- data/app/jobs/ui/application_job.rb +4 -0
- data/app/mailers/ui/application_mailer.rb +6 -0
- data/app/models/ui/application_record.rb +5 -0
- data/app/view_components/ui/accordion_component.rb +35 -0
- data/app/view_components/ui/accordion_content_component.rb +29 -0
- data/app/view_components/ui/accordion_item_component.rb +43 -0
- data/app/view_components/ui/accordion_trigger_component.rb +31 -0
- data/app/view_components/ui/alert_component.rb +23 -0
- data/app/view_components/ui/alert_description_component.rb +21 -0
- data/app/view_components/ui/alert_title_component.rb +21 -0
- data/app/view_components/ui/aspect_ratio_component.rb +26 -0
- data/app/view_components/ui/avatar_component.rb +21 -0
- data/app/view_components/ui/avatar_fallback_component.rb +21 -0
- data/app/view_components/ui/avatar_image_component.rb +23 -0
- data/app/view_components/ui/badge_component.rb +23 -0
- data/app/view_components/ui/blockquote_component.rb +18 -0
- data/app/view_components/ui/breadcrumb_component.rb +33 -0
- data/app/view_components/ui/breadcrumb_ellipsis_component.rb +50 -0
- data/app/view_components/ui/breadcrumb_item_component.rb +29 -0
- data/app/view_components/ui/breadcrumb_link_component.rb +29 -0
- data/app/view_components/ui/breadcrumb_list_component.rb +29 -0
- data/app/view_components/ui/breadcrumb_page_component.rb +27 -0
- data/app/view_components/ui/breadcrumb_separator_component.rb +47 -0
- data/app/view_components/ui/button_component.rb +43 -0
- data/app/view_components/ui/button_group_component.rb +38 -0
- data/app/view_components/ui/button_group_separator_component.rb +33 -0
- data/app/view_components/ui/button_group_text_component.rb +30 -0
- data/app/view_components/ui/calendar_component.rb +185 -0
- data/app/view_components/ui/card_action_component.rb +14 -0
- data/app/view_components/ui/card_component.rb +14 -0
- data/app/view_components/ui/card_content_component.rb +14 -0
- data/app/view_components/ui/card_description_component.rb +14 -0
- data/app/view_components/ui/card_footer_component.rb +14 -0
- data/app/view_components/ui/card_header_component.rb +14 -0
- data/app/view_components/ui/card_title_component.rb +14 -0
- data/app/view_components/ui/carousel_component.rb +16 -0
- data/app/view_components/ui/carousel_content_component.rb +15 -0
- data/app/view_components/ui/carousel_item_component.rb +13 -0
- data/app/view_components/ui/carousel_next_component.rb +31 -0
- data/app/view_components/ui/carousel_previous_component.rb +31 -0
- data/app/view_components/ui/checkbox_component.rb +55 -0
- data/app/view_components/ui/collapsible_component.rb +23 -0
- data/app/view_components/ui/collapsible_content_component.rb +15 -0
- data/app/view_components/ui/collapsible_trigger_component.rb +21 -0
- data/app/view_components/ui/combobox_wrapper_component.rb +56 -0
- data/app/view_components/ui/command_component.rb +15 -0
- data/app/view_components/ui/command_dialog_component.rb +25 -0
- data/app/view_components/ui/command_empty_component.rb +14 -0
- data/app/view_components/ui/command_group_component.rb +21 -0
- data/app/view_components/ui/command_input_component.rb +20 -0
- data/app/view_components/ui/command_item_component.rb +16 -0
- data/app/view_components/ui/command_list_component.rb +14 -0
- data/app/view_components/ui/command_separator_component.rb +14 -0
- data/app/view_components/ui/command_shortcut_component.rb +14 -0
- data/app/view_components/ui/context_menu_checkbox_item_component.rb +45 -0
- data/app/view_components/ui/context_menu_component.rb +20 -0
- data/app/view_components/ui/context_menu_content_component.rb +20 -0
- data/app/view_components/ui/context_menu_item_component.rb +29 -0
- data/app/view_components/ui/context_menu_label_component.rb +22 -0
- data/app/view_components/ui/context_menu_radio_group_component.rb +19 -0
- data/app/view_components/ui/context_menu_radio_item_component.rb +45 -0
- data/app/view_components/ui/context_menu_separator_component.rb +15 -0
- data/app/view_components/ui/context_menu_shortcut_component.rb +19 -0
- data/app/view_components/ui/context_menu_trigger_component.rb +20 -0
- data/app/view_components/ui/date_picker_component.rb +137 -0
- data/app/view_components/ui/date_picker_input_component.rb +76 -0
- data/app/view_components/ui/date_picker_trigger_component.rb +79 -0
- data/app/view_components/ui/dialog_close_component.rb +71 -0
- data/app/view_components/ui/dialog_component.rb +50 -0
- data/app/view_components/ui/dialog_content_component.rb +28 -0
- data/app/view_components/ui/dialog_description_component.rb +26 -0
- data/app/view_components/ui/dialog_footer_component.rb +21 -0
- data/app/view_components/ui/dialog_header_component.rb +22 -0
- data/app/view_components/ui/dialog_overlay_component.rb +36 -0
- data/app/view_components/ui/dialog_title_component.rb +26 -0
- data/app/view_components/ui/dialog_trigger_component.rb +71 -0
- data/app/view_components/ui/drawer_close_component.rb +35 -0
- data/app/view_components/ui/drawer_component.rb +81 -0
- data/app/view_components/ui/drawer_content_component.rb +32 -0
- data/app/view_components/ui/drawer_description_component.rb +21 -0
- data/app/view_components/ui/drawer_footer_component.rb +24 -0
- data/app/view_components/ui/drawer_handle_component.rb +24 -0
- data/app/view_components/ui/drawer_header_component.rb +24 -0
- data/app/view_components/ui/drawer_overlay_component.rb +28 -0
- data/app/view_components/ui/drawer_title_component.rb +21 -0
- data/app/view_components/ui/drawer_trigger_component.rb +71 -0
- data/app/view_components/ui/dropdown_menu_checkbox_item_component.rb +36 -0
- data/app/view_components/ui/dropdown_menu_component.rb +52 -0
- data/app/view_components/ui/dropdown_menu_content_component.rb +18 -0
- data/app/view_components/ui/dropdown_menu_item_component.rb +21 -0
- data/app/view_components/ui/dropdown_menu_label_component.rb +18 -0
- data/app/view_components/ui/dropdown_menu_radio_group_component.rb +17 -0
- data/app/view_components/ui/dropdown_menu_radio_item_component.rb +37 -0
- data/app/view_components/ui/dropdown_menu_separator_component.rb +15 -0
- data/app/view_components/ui/dropdown_menu_shortcut_component.rb +17 -0
- data/app/view_components/ui/dropdown_menu_sub_component.rb +17 -0
- data/app/view_components/ui/dropdown_menu_sub_content_component.rb +19 -0
- data/app/view_components/ui/dropdown_menu_sub_trigger_component.rb +29 -0
- data/app/view_components/ui/dropdown_menu_trigger_component.rb +52 -0
- data/app/view_components/ui/empty_component.rb +17 -0
- data/app/view_components/ui/empty_content_component.rb +17 -0
- data/app/view_components/ui/empty_description_component.rb +17 -0
- data/app/view_components/ui/empty_header_component.rb +17 -0
- data/app/view_components/ui/empty_media_component.rb +18 -0
- data/app/view_components/ui/empty_title_component.rb +17 -0
- data/app/view_components/ui/field_component.rb +41 -0
- data/app/view_components/ui/field_content_component.rb +27 -0
- data/app/view_components/ui/field_description_component.rb +27 -0
- data/app/view_components/ui/field_error_component.rb +63 -0
- data/app/view_components/ui/field_group_component.rb +32 -0
- data/app/view_components/ui/field_label_component.rb +29 -0
- data/app/view_components/ui/field_legend_component.rb +34 -0
- data/app/view_components/ui/field_separator_component.rb +53 -0
- data/app/view_components/ui/field_set_component.rb +30 -0
- data/app/view_components/ui/field_title_component.rb +27 -0
- data/app/view_components/ui/h1_component.rb +21 -0
- data/app/view_components/ui/h2_component.rb +21 -0
- data/app/view_components/ui/h3_component.rb +18 -0
- data/app/view_components/ui/h4_component.rb +18 -0
- data/app/view_components/ui/hover_card_component.rb +30 -0
- data/app/view_components/ui/hover_card_content_component.rb +36 -0
- data/app/view_components/ui/hover_card_trigger_component.rb +54 -0
- data/app/view_components/ui/inline_code_component.rb +18 -0
- data/app/view_components/ui/input_component.rb +23 -0
- data/app/view_components/ui/input_group_addon_component.rb +36 -0
- data/app/view_components/ui/input_group_button_component.rb +36 -0
- data/app/view_components/ui/input_group_component.rb +35 -0
- data/app/view_components/ui/input_group_input_component.rb +42 -0
- data/app/view_components/ui/input_group_text_component.rb +33 -0
- data/app/view_components/ui/input_group_textarea_component.rb +42 -0
- data/app/view_components/ui/input_otp_component.rb +61 -0
- data/app/view_components/ui/input_otp_group_component.rb +29 -0
- data/app/view_components/ui/input_otp_separator_component.rb +36 -0
- data/app/view_components/ui/input_otp_slot_component.rb +32 -0
- data/app/view_components/ui/item_actions_component.rb +18 -0
- data/app/view_components/ui/item_component.rb +30 -0
- data/app/view_components/ui/item_content_component.rb +18 -0
- data/app/view_components/ui/item_description_component.rb +18 -0
- data/app/view_components/ui/item_footer_component.rb +18 -0
- data/app/view_components/ui/item_group_component.rb +18 -0
- data/app/view_components/ui/item_header_component.rb +18 -0
- data/app/view_components/ui/item_media_component.rb +19 -0
- data/app/view_components/ui/item_separator_component.rb +18 -0
- data/app/view_components/ui/item_title_component.rb +18 -0
- data/app/view_components/ui/kbd_component.rb +31 -0
- data/app/view_components/ui/kbd_group_component.rb +32 -0
- data/app/view_components/ui/label_component.rb +23 -0
- data/app/view_components/ui/large_component.rb +18 -0
- data/app/view_components/ui/lead_component.rb +18 -0
- data/app/view_components/ui/list_component.rb +18 -0
- data/app/view_components/ui/menubar_checkbox_item_component.rb +47 -0
- data/app/view_components/ui/menubar_component.rb +24 -0
- data/app/view_components/ui/menubar_content_component.rb +26 -0
- data/app/view_components/ui/menubar_item_component.rb +31 -0
- data/app/view_components/ui/menubar_label_component.rb +23 -0
- data/app/view_components/ui/menubar_menu_component.rb +25 -0
- data/app/view_components/ui/menubar_radio_group_component.rb +26 -0
- data/app/view_components/ui/menubar_radio_item_component.rb +48 -0
- data/app/view_components/ui/menubar_separator_component.rb +20 -0
- data/app/view_components/ui/menubar_shortcut_component.rb +22 -0
- data/app/view_components/ui/menubar_sub_component.rb +25 -0
- data/app/view_components/ui/menubar_sub_content_component.rb +25 -0
- data/app/view_components/ui/menubar_sub_trigger_component.rb +43 -0
- data/app/view_components/ui/menubar_trigger_component.rb +23 -0
- data/app/view_components/ui/muted_component.rb +18 -0
- data/app/view_components/ui/navigation_menu_component.rb +42 -0
- data/app/view_components/ui/navigation_menu_content_component.rb +23 -0
- data/app/view_components/ui/navigation_menu_item_component.rb +23 -0
- data/app/view_components/ui/navigation_menu_link_component.rb +101 -0
- data/app/view_components/ui/navigation_menu_list_component.rb +21 -0
- data/app/view_components/ui/navigation_menu_trigger_component.rb +45 -0
- data/app/view_components/ui/navigation_menu_viewport_component.rb +21 -0
- data/app/view_components/ui/p_component.rb +18 -0
- data/app/view_components/ui/pagination_component.rb +18 -0
- data/app/view_components/ui/pagination_content_component.rb +18 -0
- data/app/view_components/ui/pagination_ellipsis_component.rb +25 -0
- data/app/view_components/ui/pagination_item_component.rb +16 -0
- data/app/view_components/ui/pagination_link_component.rb +26 -0
- data/app/view_components/ui/pagination_next_component.rb +30 -0
- data/app/view_components/ui/pagination_previous_component.rb +30 -0
- data/app/view_components/ui/popover_component.rb +55 -0
- data/app/view_components/ui/popover_content_component.rb +43 -0
- data/app/view_components/ui/popover_trigger_component.rb +72 -0
- data/app/view_components/ui/progress_component.rb +39 -0
- data/app/view_components/ui/radio_button_component.rb +56 -0
- data/app/view_components/ui/resizable_handle_component.rb +35 -0
- data/app/view_components/ui/resizable_panel_component.rb +39 -0
- data/app/view_components/ui/resizable_panel_group_component.rb +45 -0
- data/app/view_components/ui/responsive_dialog_component.rb +81 -0
- data/app/view_components/ui/scroll_area_component.rb +46 -0
- data/app/view_components/ui/scroll_area_corner_component.rb +22 -0
- data/app/view_components/ui/scroll_area_scrollbar_component.rb +35 -0
- data/app/view_components/ui/scroll_area_thumb_component.rb +29 -0
- data/app/view_components/ui/scroll_area_viewport_component.rb +32 -0
- data/app/view_components/ui/select_component.rb +31 -0
- data/app/view_components/ui/select_content_component.rb +41 -0
- data/app/view_components/ui/select_group_component.rb +26 -0
- data/app/view_components/ui/select_item_component.rb +45 -0
- data/app/view_components/ui/select_label_component.rb +22 -0
- data/app/view_components/ui/select_scroll_down_button_component.rb +35 -0
- data/app/view_components/ui/select_scroll_up_button_component.rb +35 -0
- data/app/view_components/ui/select_trigger_component.rb +27 -0
- data/app/view_components/ui/separator_component.rb +27 -0
- data/app/view_components/ui/sheet_close_component.rb +71 -0
- data/app/view_components/ui/sheet_component.rb +50 -0
- data/app/view_components/ui/sheet_content_component.rb +52 -0
- data/app/view_components/ui/sheet_description_component.rb +25 -0
- data/app/view_components/ui/sheet_footer_component.rb +21 -0
- data/app/view_components/ui/sheet_header_component.rb +21 -0
- data/app/view_components/ui/sheet_overlay_component.rb +36 -0
- data/app/view_components/ui/sheet_title_component.rb +25 -0
- data/app/view_components/ui/sheet_trigger_component.rb +60 -0
- data/app/view_components/ui/skeleton_component.rb +30 -0
- data/app/view_components/ui/slider_component.rb +61 -0
- data/app/view_components/ui/slider_range_component.rb +24 -0
- data/app/view_components/ui/slider_thumb_component.rb +30 -0
- data/app/view_components/ui/slider_track_component.rb +28 -0
- data/app/view_components/ui/small_component.rb +18 -0
- data/app/view_components/ui/sonner_toaster_component.rb +53 -0
- data/app/view_components/ui/spinner_component.rb +48 -0
- data/app/view_components/ui/switch_component.rb +55 -0
- data/app/view_components/ui/table_body_component.rb +21 -0
- data/app/view_components/ui/table_caption_component.rb +14 -0
- data/app/view_components/ui/table_cell_component.rb +14 -0
- data/app/view_components/ui/table_component.rb +27 -0
- data/app/view_components/ui/table_footer_component.rb +21 -0
- data/app/view_components/ui/table_head_component.rb +14 -0
- data/app/view_components/ui/table_header_component.rb +21 -0
- data/app/view_components/ui/table_row_component.rb +23 -0
- data/app/view_components/ui/tabs_component.rb +39 -0
- data/app/view_components/ui/tabs_content_component.rb +34 -0
- data/app/view_components/ui/tabs_list_component.rb +30 -0
- data/app/view_components/ui/tabs_trigger_component.rb +37 -0
- data/app/view_components/ui/textarea_component.rb +18 -0
- data/app/view_components/ui/toggle_component.rb +48 -0
- data/app/view_components/ui/toggle_group_component.rb +68 -0
- data/app/view_components/ui/toggle_group_item_component.rb +72 -0
- data/app/view_components/ui/tooltip_component.rb +19 -0
- data/app/view_components/ui/tooltip_content_component.rb +28 -0
- data/app/view_components/ui/tooltip_trigger_component.rb +25 -0
- data/app/views/layouts/ui/application.html.erb +21 -0
- data/app/views/ui/_accordion.html.erb +17 -0
- data/app/views/ui/_alert.html.erb +22 -0
- data/app/views/ui/_aspect_ratio.html.erb +18 -0
- data/app/views/ui/_avatar.html.erb +13 -0
- data/app/views/ui/_badge.html.erb +18 -0
- data/app/views/ui/_blockquote.html.erb +19 -0
- data/app/views/ui/_breadcrumb.html.erb +14 -0
- data/app/views/ui/_button.html.erb +38 -0
- data/app/views/ui/_button_group.html.erb +17 -0
- data/app/views/ui/_calendar.html.erb +172 -0
- data/app/views/ui/_card.html.erb +18 -0
- data/app/views/ui/_carousel.html.erb +17 -0
- data/app/views/ui/_checkbox.html.erb +32 -0
- data/app/views/ui/_collapsible.html.erb +23 -0
- data/app/views/ui/_command.html.erb +19 -0
- data/app/views/ui/_context_menu.html.erb +21 -0
- data/app/views/ui/_date_picker.html.erb +93 -0
- data/app/views/ui/_dialog.html.erb +18 -0
- data/app/views/ui/_drawer.html.erb +25 -0
- data/app/views/ui/_dropdown_menu.html.erb +40 -0
- data/app/views/ui/_empty.html.erb +13 -0
- data/app/views/ui/_field.html.erb +15 -0
- data/app/views/ui/_h1.html.erb +19 -0
- data/app/views/ui/_h2.html.erb +19 -0
- data/app/views/ui/_h3.html.erb +19 -0
- data/app/views/ui/_h4.html.erb +19 -0
- data/app/views/ui/_hover_card.html.erb +14 -0
- data/app/views/ui/_inline_code.html.erb +19 -0
- data/app/views/ui/_input.html.erb +18 -0
- data/app/views/ui/_input_group.html.erb +14 -0
- data/app/views/ui/_input_otp.html.erb +44 -0
- data/app/views/ui/_item.html.erb +9 -0
- data/app/views/ui/_kbd.html.erb +15 -0
- data/app/views/ui/_label.html.erb +16 -0
- data/app/views/ui/_large.html.erb +19 -0
- data/app/views/ui/_lead.html.erb +19 -0
- data/app/views/ui/_list.html.erb +19 -0
- data/app/views/ui/_menubar.html.erb +25 -0
- data/app/views/ui/_muted.html.erb +19 -0
- data/app/views/ui/_navigation_menu.html.erb +34 -0
- data/app/views/ui/_p.html.erb +19 -0
- data/app/views/ui/_pagination.html.erb +14 -0
- data/app/views/ui/_popover.html.erb +19 -0
- data/app/views/ui/_progress.html.erb +15 -0
- data/app/views/ui/_radio_button.html.erb +34 -0
- data/app/views/ui/_responsive_dialog.html.erb +44 -0
- data/app/views/ui/_scroll_area.html.erb +60 -0
- data/app/views/ui/_select.html.erb +17 -0
- data/app/views/ui/_separator.html.erb +20 -0
- data/app/views/ui/_sheet.html.erb +18 -0
- data/app/views/ui/_skeleton.html.erb +19 -0
- data/app/views/ui/_slider.html.erb +27 -0
- data/app/views/ui/_small.html.erb +19 -0
- data/app/views/ui/_spinner.html.erb +28 -0
- data/app/views/ui/_switch.html.erb +45 -0
- data/app/views/ui/_table.html.erb +18 -0
- data/app/views/ui/_tabs.html.erb +23 -0
- data/app/views/ui/_textarea.html.erb +16 -0
- data/app/views/ui/_toggle.html.erb +27 -0
- data/app/views/ui/_toggle_group.html.erb +38 -0
- data/app/views/ui/_tooltip.html.erb +13 -0
- data/app/views/ui/accordion/_content.html.erb +21 -0
- data/app/views/ui/accordion/_item.html.erb +21 -0
- data/app/views/ui/accordion/_trigger.html.erb +23 -0
- data/app/views/ui/alert/_description.html.erb +13 -0
- data/app/views/ui/alert/_title.html.erb +13 -0
- data/app/views/ui/avatar/_fallback.html.erb +13 -0
- data/app/views/ui/avatar/_image.html.erb +18 -0
- data/app/views/ui/breadcrumb/_ellipsis.html.erb +26 -0
- data/app/views/ui/breadcrumb/_item.html.erb +14 -0
- data/app/views/ui/breadcrumb/_link.html.erb +16 -0
- data/app/views/ui/breadcrumb/_list.html.erb +14 -0
- data/app/views/ui/breadcrumb/_page.html.erb +15 -0
- data/app/views/ui/breadcrumb/_separator.html.erb +23 -0
- data/app/views/ui/button_group/_separator.html.erb +19 -0
- data/app/views/ui/button_group/_text.html.erb +16 -0
- data/app/views/ui/card/_action.html.erb +18 -0
- data/app/views/ui/card/_content.html.erb +18 -0
- data/app/views/ui/card/_description.html.erb +20 -0
- data/app/views/ui/card/_footer.html.erb +18 -0
- data/app/views/ui/card/_header.html.erb +18 -0
- data/app/views/ui/card/_title.html.erb +20 -0
- data/app/views/ui/carousel/_content.html.erb +16 -0
- data/app/views/ui/carousel/_item.html.erb +14 -0
- data/app/views/ui/carousel/_next.html.erb +13 -0
- data/app/views/ui/carousel/_previous.html.erb +13 -0
- data/app/views/ui/collapsible/_content.html.erb +20 -0
- data/app/views/ui/collapsible/_trigger.html.erb +18 -0
- data/app/views/ui/combobox/_wrapper.html.erb +43 -0
- data/app/views/ui/command/_dialog.html.erb +17 -0
- data/app/views/ui/command/_empty.html.erb +19 -0
- data/app/views/ui/command/_group.html.erb +23 -0
- data/app/views/ui/command/_input.html.erb +20 -0
- data/app/views/ui/command/_item.html.erb +21 -0
- data/app/views/ui/command/_list.html.erb +17 -0
- data/app/views/ui/command/_separator.html.erb +15 -0
- data/app/views/ui/command/_shortcut.html.erb +19 -0
- data/app/views/ui/context_menu/_checkbox_item.html.erb +23 -0
- data/app/views/ui/context_menu/_content.html.erb +15 -0
- data/app/views/ui/context_menu/_item.html.erb +19 -0
- data/app/views/ui/context_menu/_label.html.erb +16 -0
- data/app/views/ui/context_menu/_radio_group.html.erb +14 -0
- data/app/views/ui/context_menu/_radio_item.html.erb +23 -0
- data/app/views/ui/context_menu/_separator.html.erb +12 -0
- data/app/views/ui/context_menu/_shortcut.html.erb +15 -0
- data/app/views/ui/context_menu/_trigger.html.erb +14 -0
- data/app/views/ui/date_picker/_input.html.erb +47 -0
- data/app/views/ui/date_picker/_trigger.html.erb +53 -0
- data/app/views/ui/dialog/_close.html.erb +24 -0
- data/app/views/ui/dialog/_content.html.erb +22 -0
- data/app/views/ui/dialog/_description.html.erb +14 -0
- data/app/views/ui/dialog/_footer.html.erb +14 -0
- data/app/views/ui/dialog/_header.html.erb +14 -0
- data/app/views/ui/dialog/_overlay.html.erb +19 -0
- data/app/views/ui/dialog/_title.html.erb +14 -0
- data/app/views/ui/dialog/_trigger.html.erb +24 -0
- data/app/views/ui/drawer/_close.html.erb +17 -0
- data/app/views/ui/drawer/_content.html.erb +31 -0
- data/app/views/ui/drawer/_description.html.erb +15 -0
- data/app/views/ui/drawer/_footer.html.erb +15 -0
- data/app/views/ui/drawer/_handle.html.erb +12 -0
- data/app/views/ui/drawer/_header.html.erb +15 -0
- data/app/views/ui/drawer/_overlay.html.erb +16 -0
- data/app/views/ui/drawer/_title.html.erb +15 -0
- data/app/views/ui/drawer/_trigger.html.erb +25 -0
- data/app/views/ui/dropdown_menu/_checkbox_item.html.erb +24 -0
- data/app/views/ui/dropdown_menu/_content.html.erb +15 -0
- data/app/views/ui/dropdown_menu/_item.html.erb +24 -0
- data/app/views/ui/dropdown_menu/_label.html.erb +16 -0
- data/app/views/ui/dropdown_menu/_radio_group.html.erb +15 -0
- data/app/views/ui/dropdown_menu/_radio_item.html.erb +27 -0
- data/app/views/ui/dropdown_menu/_separator.html.erb +12 -0
- data/app/views/ui/dropdown_menu/_shortcut.html.erb +15 -0
- data/app/views/ui/dropdown_menu/_sub.html.erb +14 -0
- data/app/views/ui/dropdown_menu/_sub_content.html.erb +17 -0
- data/app/views/ui/dropdown_menu/_sub_trigger.html.erb +17 -0
- data/app/views/ui/dropdown_menu/_trigger.html.erb +20 -0
- data/app/views/ui/empty/_content.html.erb +13 -0
- data/app/views/ui/empty/_description.html.erb +13 -0
- data/app/views/ui/empty/_header.html.erb +13 -0
- data/app/views/ui/empty/_media.html.erb +14 -0
- data/app/views/ui/empty/_title.html.erb +13 -0
- data/app/views/ui/field/_content.html.erb +14 -0
- data/app/views/ui/field/_description.html.erb +15 -0
- data/app/views/ui/field/_error.html.erb +15 -0
- data/app/views/ui/field/_group.html.erb +14 -0
- data/app/views/ui/field/_label.html.erb +15 -0
- data/app/views/ui/field/_legend.html.erb +16 -0
- data/app/views/ui/field/_separator.html.erb +15 -0
- data/app/views/ui/field/_set.html.erb +14 -0
- data/app/views/ui/field/_title.html.erb +15 -0
- data/app/views/ui/hover_card/_content.html.erb +16 -0
- data/app/views/ui/hover_card/_trigger.html.erb +27 -0
- data/app/views/ui/input_group/_addon.html.erb +15 -0
- data/app/views/ui/input_group/_button.html.erb +18 -0
- data/app/views/ui/input_group/_input.html.erb +17 -0
- data/app/views/ui/input_group/_text.html.erb +15 -0
- data/app/views/ui/input_group/_textarea.html.erb +17 -0
- data/app/views/ui/input_otp/_group.html.erb +20 -0
- data/app/views/ui/input_otp/_separator.html.erb +22 -0
- data/app/views/ui/input_otp/_slot.html.erb +28 -0
- data/app/views/ui/item/_actions.html.erb +7 -0
- data/app/views/ui/item/_content.html.erb +7 -0
- data/app/views/ui/item/_description.html.erb +7 -0
- data/app/views/ui/item/_footer.html.erb +7 -0
- data/app/views/ui/item/_group.html.erb +7 -0
- data/app/views/ui/item/_header.html.erb +7 -0
- data/app/views/ui/item/_media.html.erb +8 -0
- data/app/views/ui/item/_separator.html.erb +5 -0
- data/app/views/ui/item/_title.html.erb +7 -0
- data/app/views/ui/kbd/_group.html.erb +14 -0
- data/app/views/ui/menubar/_checkbox_item.html.erb +24 -0
- data/app/views/ui/menubar/_content.html.erb +18 -0
- data/app/views/ui/menubar/_item.html.erb +24 -0
- data/app/views/ui/menubar/_label.html.erb +16 -0
- data/app/views/ui/menubar/_menu.html.erb +14 -0
- data/app/views/ui/menubar/_radio_group.html.erb +16 -0
- data/app/views/ui/menubar/_radio_item.html.erb +25 -0
- data/app/views/ui/menubar/_separator.html.erb +12 -0
- data/app/views/ui/menubar/_shortcut.html.erb +15 -0
- data/app/views/ui/menubar/_sub.html.erb +15 -0
- data/app/views/ui/menubar/_sub_content.html.erb +15 -0
- data/app/views/ui/menubar/_sub_trigger.html.erb +20 -0
- data/app/views/ui/menubar/_trigger.html.erb +15 -0
- data/app/views/ui/navigation_menu/_content.html.erb +13 -0
- data/app/views/ui/navigation_menu/_item.html.erb +13 -0
- data/app/views/ui/navigation_menu/_link.html.erb +33 -0
- data/app/views/ui/navigation_menu/_list.html.erb +12 -0
- data/app/views/ui/navigation_menu/_trigger.html.erb +30 -0
- data/app/views/ui/navigation_menu/_viewport.html.erb +13 -0
- data/app/views/ui/pagination/_content.html.erb +14 -0
- data/app/views/ui/pagination/_ellipsis.html.erb +19 -0
- data/app/views/ui/pagination/_item.html.erb +14 -0
- data/app/views/ui/pagination/_link.html.erb +18 -0
- data/app/views/ui/pagination/_next.html.erb +19 -0
- data/app/views/ui/pagination/_previous.html.erb +19 -0
- data/app/views/ui/popover/_content.html.erb +14 -0
- data/app/views/ui/popover/_trigger.html.erb +15 -0
- data/app/views/ui/resizable/_handle.html.erb +22 -0
- data/app/views/ui/resizable/_panel.html.erb +21 -0
- data/app/views/ui/resizable/_panel_group.html.erb +20 -0
- data/app/views/ui/scroll_area/_corner.html.erb +40 -0
- data/app/views/ui/scroll_area/_scrollbar.html.erb +50 -0
- data/app/views/ui/scroll_area/_thumb.html.erb +44 -0
- data/app/views/ui/scroll_area/_viewport.html.erb +47 -0
- data/app/views/ui/select/_content.html.erb +25 -0
- data/app/views/ui/select/_group.html.erb +42 -0
- data/app/views/ui/select/_item.html.erb +48 -0
- data/app/views/ui/select/_label.html.erb +42 -0
- data/app/views/ui/select/_scroll_down_button.html.erb +44 -0
- data/app/views/ui/select/_scroll_up_button.html.erb +44 -0
- data/app/views/ui/select/_trigger.html.erb +43 -0
- data/app/views/ui/sheet/_close.html.erb +24 -0
- data/app/views/ui/sheet/_content.html.erb +30 -0
- data/app/views/ui/sheet/_description.html.erb +14 -0
- data/app/views/ui/sheet/_footer.html.erb +14 -0
- data/app/views/ui/sheet/_header.html.erb +14 -0
- data/app/views/ui/sheet/_overlay.html.erb +19 -0
- data/app/views/ui/sheet/_title.html.erb +14 -0
- data/app/views/ui/sheet/_trigger.html.erb +21 -0
- data/app/views/ui/slider/_range.html.erb +13 -0
- data/app/views/ui/slider/_thumb.html.erb +14 -0
- data/app/views/ui/slider/_track.html.erb +16 -0
- data/app/views/ui/sonner/_toaster.html.erb +38 -0
- data/app/views/ui/table/_body.html.erb +18 -0
- data/app/views/ui/table/_caption.html.erb +18 -0
- data/app/views/ui/table/_cell.html.erb +18 -0
- data/app/views/ui/table/_footer.html.erb +18 -0
- data/app/views/ui/table/_head.html.erb +18 -0
- data/app/views/ui/table/_header.html.erb +18 -0
- data/app/views/ui/table/_row.html.erb +18 -0
- data/app/views/ui/tabs/_content.html.erb +19 -0
- data/app/views/ui/tabs/_list.html.erb +16 -0
- data/app/views/ui/tabs/_trigger.html.erb +20 -0
- data/app/views/ui/toggle_group/_item.html.erb +51 -0
- data/app/views/ui/tooltip/_content.html.erb +17 -0
- data/app/views/ui/tooltip/_trigger.html.erb +39 -0
- data/config/importmap.rb +6 -0
- data/config/routes.rb +3 -0
- data/lib/fernandes-ui.rb +12 -0
- data/lib/generators/ui/install/install_generator.rb +141 -0
- data/lib/generators/ui/install/templates/Procfile.dev +2 -0
- data/lib/generators/ui/install/templates/application.tailwind.css +32 -0
- data/lib/generators/ui/install/templates/package.json +13 -0
- data/lib/tasks/ui_tasks.rake +4 -0
- data/lib/ui/configuration.rb +54 -0
- data/lib/ui/engine.rb +158 -0
- data/lib/ui/version.rb +3 -0
- data/lib/ui.rb +8 -0
- metadata +1214 -0
|
@@ -0,0 +1,850 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
import { computePosition, flip, offset, shift, autoUpdate } from "@floating-ui/dom"
|
|
3
|
+
import {
|
|
4
|
+
getFocusableItems,
|
|
5
|
+
findCurrentItemIndex,
|
|
6
|
+
focusItem as focusItemUtil,
|
|
7
|
+
focusNextItem as focusNextItemUtil,
|
|
8
|
+
focusPreviousItem as focusPreviousItemUtil,
|
|
9
|
+
hasSubmenu,
|
|
10
|
+
openSubmenu,
|
|
11
|
+
closeSubmenu,
|
|
12
|
+
closeAllSubmenus,
|
|
13
|
+
positionSubmenu,
|
|
14
|
+
clearAllTabindexes,
|
|
15
|
+
getKeyboardFocusedItem
|
|
16
|
+
} from "../utils/menu_utils.js"
|
|
17
|
+
|
|
18
|
+
// Dropdown Menu controller with keyboard navigation support
|
|
19
|
+
export default class extends Controller {
|
|
20
|
+
static targets = ["trigger", "menu", "content", "item"]
|
|
21
|
+
static values = {
|
|
22
|
+
open: { type: Boolean, default: false },
|
|
23
|
+
placement: { type: String, default: "bottom-start" },
|
|
24
|
+
offset: { type: Number, default: 4 },
|
|
25
|
+
flip: { type: Boolean, default: true },
|
|
26
|
+
strategy: { type: String, default: "fixed" }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments)
|
|
31
|
+
this.cleanup = null
|
|
32
|
+
this.closeSubmenuTimeouts = new Map() // Track timeouts for closing submenus
|
|
33
|
+
this.lastHoveredItem = null // Track last item with mouse hover
|
|
34
|
+
this.shouldReturnFocusToTrigger = false // Flag to return focus after closing
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
connect() {
|
|
38
|
+
// Close dropdown when clicking outside
|
|
39
|
+
this.boundHandleClickOutside = this.handleClickOutside.bind(this)
|
|
40
|
+
this.boundHandleKeydown = this.handleKeydown.bind(this)
|
|
41
|
+
this.boundHandleFocusOut = this.handleFocusOut.bind(this)
|
|
42
|
+
document.addEventListener('click', this.boundHandleClickOutside)
|
|
43
|
+
|
|
44
|
+
// Listen for focus leaving the dropdown
|
|
45
|
+
this.element.addEventListener('focusout', this.boundHandleFocusOut)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
disconnect() {
|
|
49
|
+
// Cleanup Floating UI auto-update
|
|
50
|
+
if (this.cleanup) {
|
|
51
|
+
this.cleanup()
|
|
52
|
+
this.cleanup = null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Clear all pending submenu close timeouts
|
|
56
|
+
this.closeSubmenuTimeouts.forEach((timeoutId) => clearTimeout(timeoutId))
|
|
57
|
+
this.closeSubmenuTimeouts.clear()
|
|
58
|
+
|
|
59
|
+
document.removeEventListener('click', this.boundHandleClickOutside)
|
|
60
|
+
document.removeEventListener('keydown', this.boundHandleKeydown)
|
|
61
|
+
this.element.removeEventListener('focusout', this.boundHandleFocusOut)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
handleFocusOut(event) {
|
|
65
|
+
// Don't do anything if dropdown is not open
|
|
66
|
+
if (!this.openValue) return
|
|
67
|
+
|
|
68
|
+
// Check if focus is moving outside the dropdown element
|
|
69
|
+
// Use setTimeout to allow the new focus target to be set
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
const newFocusedElement = document.activeElement
|
|
72
|
+
|
|
73
|
+
// If the new focused element is outside our dropdown, close without returning focus
|
|
74
|
+
if (!this.element.contains(newFocusedElement)) {
|
|
75
|
+
this.close({ returnFocus: false })
|
|
76
|
+
}
|
|
77
|
+
}, 0)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Submenu hover handlers
|
|
81
|
+
openSubmenuHandler(event) {
|
|
82
|
+
const trigger = event.currentTarget
|
|
83
|
+
const submenu = trigger.nextElementSibling
|
|
84
|
+
|
|
85
|
+
// Remove DOM focus from currently focused element to clear :focus pseudo-class
|
|
86
|
+
if (document.activeElement && document.activeElement.hasAttribute('role') &&
|
|
87
|
+
document.activeElement.getAttribute('role') === 'menuitem') {
|
|
88
|
+
document.activeElement.blur()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Remove keyboard focus from all items, except this one
|
|
92
|
+
clearAllTabindexes(this.element)
|
|
93
|
+
|
|
94
|
+
// Set tabindex="0" on the hovered trigger
|
|
95
|
+
trigger.setAttribute('tabindex', '0')
|
|
96
|
+
|
|
97
|
+
// Track the hovered item for keyboard navigation continuity
|
|
98
|
+
this.lastHoveredItem = trigger
|
|
99
|
+
|
|
100
|
+
// Cancel any pending close timeout for this submenu
|
|
101
|
+
if (this.closeSubmenuTimeouts.has(trigger)) {
|
|
102
|
+
clearTimeout(this.closeSubmenuTimeouts.get(trigger))
|
|
103
|
+
this.closeSubmenuTimeouts.delete(trigger)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (submenu && submenu.hasAttribute('role') && submenu.getAttribute('role') === 'menu') {
|
|
107
|
+
// Close sibling submenus (not parent or child submenus)
|
|
108
|
+
this.closeSiblingSubmenus(trigger)
|
|
109
|
+
|
|
110
|
+
// Open this submenu using utility
|
|
111
|
+
openSubmenu(trigger, submenu)
|
|
112
|
+
|
|
113
|
+
// If submenu contains a command controller, focus first item
|
|
114
|
+
this.focusFirstCommandItem(submenu)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Backwards compatibility alias
|
|
119
|
+
openSubmenu(event) {
|
|
120
|
+
return this.openSubmenuHandler(event)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Focus first item in command menu if present in submenu
|
|
124
|
+
focusFirstCommandItem(submenu) {
|
|
125
|
+
const commandElement = submenu.querySelector('[data-controller~="command"]')
|
|
126
|
+
if (!commandElement) return
|
|
127
|
+
|
|
128
|
+
// Wait a tick for command controller to initialize
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
const firstOption = commandElement.querySelector('[role="option"]:not([data-hidden])')
|
|
131
|
+
if (firstOption) {
|
|
132
|
+
// Remove any existing focus
|
|
133
|
+
const allOptions = commandElement.querySelectorAll('[role="option"]')
|
|
134
|
+
allOptions.forEach(option => {
|
|
135
|
+
option.removeAttribute('data-focused')
|
|
136
|
+
option.classList.remove('bg-accent', 'text-accent-foreground')
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
// Focus first item
|
|
140
|
+
firstOption.setAttribute('data-focused', 'true')
|
|
141
|
+
firstOption.classList.add('bg-accent', 'text-accent-foreground')
|
|
142
|
+
}
|
|
143
|
+
}, 50)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Track hovered item (for items without submenu)
|
|
147
|
+
trackHoveredItem(event) {
|
|
148
|
+
const item = event.currentTarget
|
|
149
|
+
|
|
150
|
+
// Remove DOM focus from currently focused element to clear :focus pseudo-class
|
|
151
|
+
if (document.activeElement && document.activeElement.hasAttribute('role') &&
|
|
152
|
+
document.activeElement.getAttribute('role') === 'menuitem') {
|
|
153
|
+
document.activeElement.blur()
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Remove keyboard focus from all items, except this one
|
|
157
|
+
clearAllTabindexes(this.element)
|
|
158
|
+
|
|
159
|
+
// Set tabindex="0" on the hovered item
|
|
160
|
+
item.setAttribute('tabindex', '0')
|
|
161
|
+
|
|
162
|
+
// Track the hovered item for keyboard navigation continuity
|
|
163
|
+
this.lastHoveredItem = item
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Toggle checkbox state
|
|
167
|
+
toggleCheckbox(event) {
|
|
168
|
+
const item = event.currentTarget
|
|
169
|
+
|
|
170
|
+
// Only handle checkbox items
|
|
171
|
+
if (item.getAttribute('role') !== 'menuitemcheckbox') return
|
|
172
|
+
|
|
173
|
+
// Don't close dropdown when clicking checkbox
|
|
174
|
+
event.stopPropagation()
|
|
175
|
+
|
|
176
|
+
// Toggle checked state
|
|
177
|
+
const currentState = item.getAttribute('data-state')
|
|
178
|
+
const newState = currentState === 'checked' ? 'unchecked' : 'checked'
|
|
179
|
+
const isChecked = newState === 'checked'
|
|
180
|
+
|
|
181
|
+
item.setAttribute('data-state', newState)
|
|
182
|
+
item.setAttribute('aria-checked', isChecked)
|
|
183
|
+
|
|
184
|
+
// Toggle check icon visibility
|
|
185
|
+
const checkIcon = item.querySelector('[data-state="checked"]')
|
|
186
|
+
if (checkIcon) {
|
|
187
|
+
checkIcon.parentElement.innerHTML = isChecked ? `
|
|
188
|
+
<span data-state="checked">
|
|
189
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check size-4">
|
|
190
|
+
<path d="M20 6 9 17l-5-5"></path>
|
|
191
|
+
</svg>
|
|
192
|
+
</span>
|
|
193
|
+
` : ''
|
|
194
|
+
} else if (isChecked) {
|
|
195
|
+
// Add check icon if it doesn't exist
|
|
196
|
+
const iconContainer = item.querySelector('.absolute.left-2')
|
|
197
|
+
if (iconContainer) {
|
|
198
|
+
iconContainer.innerHTML = `
|
|
199
|
+
<span data-state="checked">
|
|
200
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check size-4">
|
|
201
|
+
<path d="M20 6 9 17l-5-5"></path>
|
|
202
|
+
</svg>
|
|
203
|
+
</span>
|
|
204
|
+
`
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Select radio item (only one can be selected in a group)
|
|
210
|
+
selectRadio(event) {
|
|
211
|
+
const item = event.currentTarget
|
|
212
|
+
|
|
213
|
+
// Only handle radio items
|
|
214
|
+
if (item.getAttribute('role') !== 'menuitemradio') return
|
|
215
|
+
|
|
216
|
+
// Don't close dropdown when clicking radio
|
|
217
|
+
event.stopPropagation()
|
|
218
|
+
|
|
219
|
+
// Find the radio group (parent menu or radio group container)
|
|
220
|
+
const radioGroup = item.closest('[role="group"]') || item.closest('[role="menu"]')
|
|
221
|
+
if (!radioGroup) return
|
|
222
|
+
|
|
223
|
+
// Uncheck all radio items in the same group
|
|
224
|
+
const allRadios = radioGroup.querySelectorAll('[role="menuitemradio"]')
|
|
225
|
+
allRadios.forEach(radio => {
|
|
226
|
+
radio.setAttribute('data-state', 'unchecked')
|
|
227
|
+
radio.setAttribute('aria-checked', 'false')
|
|
228
|
+
const iconContainer = radio.querySelector('.absolute.left-2')
|
|
229
|
+
if (iconContainer) {
|
|
230
|
+
iconContainer.innerHTML = ''
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
// Check the clicked item
|
|
235
|
+
item.setAttribute('data-state', 'checked')
|
|
236
|
+
item.setAttribute('aria-checked', 'true')
|
|
237
|
+
|
|
238
|
+
// Add radio indicator
|
|
239
|
+
const iconContainer = item.querySelector('.absolute.left-2')
|
|
240
|
+
if (iconContainer) {
|
|
241
|
+
iconContainer.innerHTML = `
|
|
242
|
+
<span data-state="checked">
|
|
243
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle size-2 fill-current">
|
|
244
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
245
|
+
</svg>
|
|
246
|
+
</span>
|
|
247
|
+
`
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
closeSubmenuHandler(event) {
|
|
252
|
+
const trigger = event.currentTarget
|
|
253
|
+
const submenu = trigger.nextElementSibling
|
|
254
|
+
const relatedTarget = event.relatedTarget
|
|
255
|
+
|
|
256
|
+
// Cancel if we're moving to the submenu itself or a child element
|
|
257
|
+
if (relatedTarget && submenu && submenu.contains(relatedTarget)) {
|
|
258
|
+
return
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Add delay before closing to allow navigation to nested submenus
|
|
262
|
+
const timeoutId = setTimeout(() => {
|
|
263
|
+
if (submenu && submenu.hasAttribute('role') && submenu.getAttribute('role') === 'menu') {
|
|
264
|
+
// Close this submenu and all its children using utility
|
|
265
|
+
closeSubmenu(submenu, trigger)
|
|
266
|
+
}
|
|
267
|
+
this.closeSubmenuTimeouts.delete(trigger)
|
|
268
|
+
}, 300) // 300ms delay allows smooth navigation
|
|
269
|
+
|
|
270
|
+
this.closeSubmenuTimeouts.set(trigger, timeoutId)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Backwards compatibility alias - closeSubmenu is used in HTML with data-action
|
|
274
|
+
closeSubmenu(event) {
|
|
275
|
+
return this.closeSubmenuHandler(event)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
closeSiblingSubmenus(currentTrigger) {
|
|
279
|
+
// Find the parent menu
|
|
280
|
+
const parentMenu = currentTrigger.closest('[role="menu"]')
|
|
281
|
+
if (!parentMenu) return
|
|
282
|
+
|
|
283
|
+
// Close all submenus that are siblings (same level)
|
|
284
|
+
// Note: We filter by data-dropdown-target for backwards compatibility with existing HTML
|
|
285
|
+
const siblingTriggers = Array.from(parentMenu.children).filter(child => {
|
|
286
|
+
return child !== currentTrigger && child.hasAttribute('data-dropdown-target') && child.getAttribute('data-dropdown-target').includes('item')
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
siblingTriggers.forEach(sibling => {
|
|
290
|
+
const siblingSubmenu = sibling.nextElementSibling
|
|
291
|
+
if (siblingSubmenu && siblingSubmenu.hasAttribute('role') && siblingSubmenu.getAttribute('role') === 'menu') {
|
|
292
|
+
closeSubmenu(siblingSubmenu, sibling)
|
|
293
|
+
}
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
closeAllSubmenusHandler() {
|
|
298
|
+
closeAllSubmenus(this.element)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Backwards compatibility alias
|
|
302
|
+
closeAllSubmenus() {
|
|
303
|
+
return this.closeAllSubmenusHandler()
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
toggle(event) {
|
|
307
|
+
// Don't stopPropagation - allow click to reach document for handleClickOutside
|
|
308
|
+
// event.stopPropagation()
|
|
309
|
+
this.openValue = !this.openValue
|
|
310
|
+
|
|
311
|
+
const target = this.hasMenuTarget ? this.menuTarget : this.contentTarget
|
|
312
|
+
target.classList.toggle('hidden')
|
|
313
|
+
|
|
314
|
+
if (!target.classList.contains('hidden')) {
|
|
315
|
+
// Menu is opening
|
|
316
|
+
target.setAttribute('data-state', 'open')
|
|
317
|
+
this.positionDropdown()
|
|
318
|
+
this.setupKeyboardNavigation()
|
|
319
|
+
|
|
320
|
+
// Focus first item after a short delay
|
|
321
|
+
setTimeout(() => {
|
|
322
|
+
this.focusItem(0)
|
|
323
|
+
}, 100)
|
|
324
|
+
} else {
|
|
325
|
+
// Menu is closing
|
|
326
|
+
target.setAttribute('data-state', 'closed')
|
|
327
|
+
this.teardownKeyboardNavigation()
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
close(options = {}) {
|
|
332
|
+
const { returnFocus = this.shouldReturnFocusToTrigger } = options
|
|
333
|
+
|
|
334
|
+
this.openValue = false
|
|
335
|
+
const target = this.hasMenuTarget ? this.menuTarget : this.contentTarget
|
|
336
|
+
|
|
337
|
+
// Close all submenus before closing main menu
|
|
338
|
+
closeAllSubmenus(this.element)
|
|
339
|
+
|
|
340
|
+
// Clear keyboard/hover focus from all items (including checkboxes and radios)
|
|
341
|
+
clearAllTabindexes(this.element)
|
|
342
|
+
|
|
343
|
+
// Clear last hovered item
|
|
344
|
+
this.lastHoveredItem = null
|
|
345
|
+
|
|
346
|
+
if (target) {
|
|
347
|
+
target.classList.add('hidden')
|
|
348
|
+
target.setAttribute('data-state', 'closed')
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Cleanup Floating UI auto-update when closing
|
|
352
|
+
if (this.cleanup) {
|
|
353
|
+
this.cleanup()
|
|
354
|
+
this.cleanup = null
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
this.teardownKeyboardNavigation()
|
|
358
|
+
|
|
359
|
+
// Return focus to trigger button (ARIA best practice)
|
|
360
|
+
if (returnFocus && this.hasTriggerTarget) {
|
|
361
|
+
setTimeout(() => {
|
|
362
|
+
this.focusTrigger()
|
|
363
|
+
}, 0)
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Reset the flag
|
|
367
|
+
this.shouldReturnFocusToTrigger = false
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Focus the trigger element, or first focusable child if trigger is not focusable
|
|
371
|
+
focusTrigger() {
|
|
372
|
+
if (!this.triggerTarget) return
|
|
373
|
+
|
|
374
|
+
// Check if trigger itself is focusable
|
|
375
|
+
const isFocusable = this.triggerTarget.matches('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
|
|
376
|
+
|
|
377
|
+
if (isFocusable) {
|
|
378
|
+
this.triggerTarget.focus()
|
|
379
|
+
} else {
|
|
380
|
+
// Find first focusable element inside the trigger
|
|
381
|
+
const focusableChild = this.triggerTarget.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
|
|
382
|
+
if (focusableChild) {
|
|
383
|
+
focusableChild.focus()
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
handleClickOutside(event) {
|
|
389
|
+
// Check if click is outside this dropdown
|
|
390
|
+
if (!this.element.contains(event.target)) {
|
|
391
|
+
this.close({ returnFocus: false })
|
|
392
|
+
} else if (this.hasTriggerTarget && this.triggerTarget.contains(event.target)) {
|
|
393
|
+
// Click is on our own trigger - toggle() will handle it, don't close here
|
|
394
|
+
return
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
setupKeyboardNavigation() {
|
|
399
|
+
document.addEventListener('keydown', this.boundHandleKeydown)
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
teardownKeyboardNavigation() {
|
|
403
|
+
document.removeEventListener('keydown', this.boundHandleKeydown)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
handleKeydown(event) {
|
|
407
|
+
if (!this.openValue) return
|
|
408
|
+
|
|
409
|
+
// Get the currently focused element
|
|
410
|
+
const focusedElement = document.activeElement
|
|
411
|
+
|
|
412
|
+
// Check if we're in a command controller by looking for a focused command option
|
|
413
|
+
const focusedCommandOption = this.element.querySelector('[data-controller~="command"] [role="option"][data-focused="true"]')
|
|
414
|
+
if (focusedCommandOption && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
|
|
415
|
+
// Let command controller handle ArrowDown/Up
|
|
416
|
+
const commandElement = focusedCommandOption.closest('[data-controller~="command"]')
|
|
417
|
+
this.handleCommandNavigation(event, commandElement)
|
|
418
|
+
return
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const items = this.getFocusableItems()
|
|
422
|
+
|
|
423
|
+
switch (event.key) {
|
|
424
|
+
case 'ArrowDown':
|
|
425
|
+
event.preventDefault()
|
|
426
|
+
this.focusNextItem(items)
|
|
427
|
+
break
|
|
428
|
+
|
|
429
|
+
case 'ArrowUp':
|
|
430
|
+
event.preventDefault()
|
|
431
|
+
this.focusPreviousItem(items)
|
|
432
|
+
break
|
|
433
|
+
|
|
434
|
+
case 'ArrowRight':
|
|
435
|
+
event.preventDefault()
|
|
436
|
+
// If focused item has a submenu, open it
|
|
437
|
+
if (focusedElement && hasSubmenu(focusedElement)) {
|
|
438
|
+
this.openSubmenuWithKeyboard(focusedElement)
|
|
439
|
+
}
|
|
440
|
+
break
|
|
441
|
+
|
|
442
|
+
case 'ArrowLeft':
|
|
443
|
+
event.preventDefault()
|
|
444
|
+
// If we're in a command, close it and return to parent menu
|
|
445
|
+
if (focusedCommandOption) {
|
|
446
|
+
const commandElement = focusedCommandOption.closest('[data-controller~="command"]')
|
|
447
|
+
this.closeCommandSubmenu(commandElement)
|
|
448
|
+
} else {
|
|
449
|
+
// Close current submenu and return focus to parent
|
|
450
|
+
this.closeCurrentSubmenuWithKeyboard(focusedElement)
|
|
451
|
+
}
|
|
452
|
+
break
|
|
453
|
+
|
|
454
|
+
case 'Home':
|
|
455
|
+
event.preventDefault()
|
|
456
|
+
this.focusItem(0, items)
|
|
457
|
+
break
|
|
458
|
+
|
|
459
|
+
case 'End':
|
|
460
|
+
event.preventDefault()
|
|
461
|
+
this.focusItem(items.length - 1, items)
|
|
462
|
+
break
|
|
463
|
+
|
|
464
|
+
case 'Escape':
|
|
465
|
+
event.preventDefault()
|
|
466
|
+
// Close only the current submenu level, or entire menu if at top level
|
|
467
|
+
if (focusedCommandOption) {
|
|
468
|
+
const commandElement = focusedCommandOption.closest('[data-controller~="command"]')
|
|
469
|
+
this.closeCommandSubmenu(commandElement)
|
|
470
|
+
} else if (!this.closeCurrentSubmenuWithKeyboard(focusedElement)) {
|
|
471
|
+
// Return focus to trigger when closing with Escape (ARIA best practice)
|
|
472
|
+
this.close({ returnFocus: true })
|
|
473
|
+
}
|
|
474
|
+
break
|
|
475
|
+
|
|
476
|
+
case 'Enter':
|
|
477
|
+
event.preventDefault()
|
|
478
|
+
// Find the item with keyboard focus (tabindex="0") or DOM focus
|
|
479
|
+
const enterTarget = getKeyboardFocusedItem(this.element) || focusedElement
|
|
480
|
+
if (enterTarget && enterTarget.hasAttribute('role')) {
|
|
481
|
+
const role = enterTarget.getAttribute('role')
|
|
482
|
+
|
|
483
|
+
if (role === 'menuitem') {
|
|
484
|
+
// Regular menu item: open submenu or activate and close
|
|
485
|
+
if (hasSubmenu(enterTarget)) {
|
|
486
|
+
this.openSubmenuWithKeyboard(enterTarget)
|
|
487
|
+
} else {
|
|
488
|
+
enterTarget.click()
|
|
489
|
+
this.close()
|
|
490
|
+
}
|
|
491
|
+
} else if (role === 'menuitemcheckbox' || role === 'menuitemradio') {
|
|
492
|
+
// Checkbox/Radio: toggle/select and close menu (ARIA spec)
|
|
493
|
+
enterTarget.click()
|
|
494
|
+
// Set flag to return focus after close completes
|
|
495
|
+
this.shouldReturnFocusToTrigger = true
|
|
496
|
+
this.close()
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
break
|
|
500
|
+
|
|
501
|
+
case ' ':
|
|
502
|
+
event.preventDefault()
|
|
503
|
+
// Find the item with keyboard focus (tabindex="0") or DOM focus
|
|
504
|
+
const spaceTarget = getKeyboardFocusedItem(this.element) || focusedElement
|
|
505
|
+
if (spaceTarget && spaceTarget.hasAttribute('role')) {
|
|
506
|
+
const role = spaceTarget.getAttribute('role')
|
|
507
|
+
|
|
508
|
+
if (role === 'menuitem') {
|
|
509
|
+
// Regular menu item: open submenu or activate and close
|
|
510
|
+
if (hasSubmenu(spaceTarget)) {
|
|
511
|
+
this.openSubmenuWithKeyboard(spaceTarget)
|
|
512
|
+
} else {
|
|
513
|
+
spaceTarget.click()
|
|
514
|
+
this.close()
|
|
515
|
+
}
|
|
516
|
+
} else if (role === 'menuitemcheckbox' || role === 'menuitemradio') {
|
|
517
|
+
// Checkbox/Radio: toggle/select but keep menu open (ARIA spec)
|
|
518
|
+
spaceTarget.click()
|
|
519
|
+
// Don't close the menu - this is the key difference from Enter
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
break
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
getFocusableItems() {
|
|
527
|
+
// Determine the current menu based on the item with tabindex="0"
|
|
528
|
+
const currentMenu = this.getCurrentMenu()
|
|
529
|
+
return getFocusableItems(this.element, currentMenu)
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
getCurrentMenu() {
|
|
533
|
+
const allItems = this.element.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]')
|
|
534
|
+
const currentItem = Array.from(allItems).find(item => item.getAttribute('tabindex') === '0')
|
|
535
|
+
|
|
536
|
+
if (currentItem) {
|
|
537
|
+
return currentItem.closest('[role="menu"]')
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// Default to the main menu if no item has tabindex="0"
|
|
541
|
+
return this.hasMenuTarget ? this.menuTarget : this.contentTarget
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
focusNextItem(items = null) {
|
|
545
|
+
items = items || this.getFocusableItems()
|
|
546
|
+
if (items.length === 0) return
|
|
547
|
+
|
|
548
|
+
const result = focusNextItemUtil(items, this.element, true)
|
|
549
|
+
if (result) {
|
|
550
|
+
this.lastHoveredItem = result
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
focusPreviousItem(items = null) {
|
|
555
|
+
items = items || this.getFocusableItems()
|
|
556
|
+
if (items.length === 0) return
|
|
557
|
+
|
|
558
|
+
const result = focusPreviousItemUtil(items, this.element, true)
|
|
559
|
+
if (result) {
|
|
560
|
+
this.lastHoveredItem = result
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
focusItem(index, items = null) {
|
|
565
|
+
// Always recalculate items to ensure we have the current menu items after any DOM changes
|
|
566
|
+
items = this.getFocusableItems()
|
|
567
|
+
if (items.length === 0 || index < 0 || index >= items.length) {
|
|
568
|
+
return
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// Close all submenus in the current menu level when navigating with keyboard
|
|
572
|
+
const currentMenu = items[0] ? items[0].closest('[role="menu"]') : null
|
|
573
|
+
if (currentMenu) {
|
|
574
|
+
const siblingsWithSubmenus = Array.from(currentMenu.children).filter(child => {
|
|
575
|
+
if (child.classList && child.classList.contains('relative')) {
|
|
576
|
+
const trigger = child.querySelector(':scope > [role="menuitem"]')
|
|
577
|
+
const submenu = trigger?.nextElementSibling
|
|
578
|
+
return submenu && submenu.hasAttribute('role') && submenu.getAttribute('role') === 'menu'
|
|
579
|
+
}
|
|
580
|
+
return false
|
|
581
|
+
})
|
|
582
|
+
|
|
583
|
+
siblingsWithSubmenus.forEach(container => {
|
|
584
|
+
const trigger = container.querySelector(':scope > [role="menuitem"]')
|
|
585
|
+
const submenu = trigger?.nextElementSibling
|
|
586
|
+
if (submenu && submenu.getAttribute('data-state') === 'open') {
|
|
587
|
+
closeSubmenu(submenu, trigger)
|
|
588
|
+
}
|
|
589
|
+
})
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// Focus the target item using utility
|
|
593
|
+
const targetItem = focusItemUtil(items, index, this.element)
|
|
594
|
+
if (targetItem) {
|
|
595
|
+
this.lastHoveredItem = targetItem
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// Open submenu with keyboard and focus first item
|
|
600
|
+
openSubmenuWithKeyboard(trigger) {
|
|
601
|
+
const submenu = trigger.nextElementSibling
|
|
602
|
+
|
|
603
|
+
if (submenu && submenu.hasAttribute('role') && submenu.getAttribute('role') === 'menu') {
|
|
604
|
+
// Close sibling submenus
|
|
605
|
+
this.closeSiblingSubmenus(trigger)
|
|
606
|
+
|
|
607
|
+
// Open this submenu using utility
|
|
608
|
+
openSubmenu(trigger, submenu)
|
|
609
|
+
|
|
610
|
+
// Check if submenu contains a command controller
|
|
611
|
+
const commandElement = submenu.querySelector('[data-controller~="command"]')
|
|
612
|
+
if (commandElement) {
|
|
613
|
+
// Focus first command item
|
|
614
|
+
this.focusFirstCommandItem(submenu)
|
|
615
|
+
return
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// Get all menuitems in the submenu
|
|
619
|
+
const submenuItems = []
|
|
620
|
+
Array.from(submenu.children).forEach(child => {
|
|
621
|
+
if (child.hasAttribute('role') && child.getAttribute('role') === 'menuitem') {
|
|
622
|
+
if (!child.hasAttribute('data-disabled')) {
|
|
623
|
+
submenuItems.push(child)
|
|
624
|
+
}
|
|
625
|
+
} else if (child.classList && child.classList.contains('relative')) {
|
|
626
|
+
const itemTrigger = child.querySelector(':scope > [role="menuitem"]')
|
|
627
|
+
if (itemTrigger && !itemTrigger.hasAttribute('data-disabled')) {
|
|
628
|
+
submenuItems.push(itemTrigger)
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
})
|
|
632
|
+
|
|
633
|
+
// Remove tabindex from ALL menuitems in the dropdown to ensure clean state
|
|
634
|
+
clearAllTabindexes(this.element)
|
|
635
|
+
|
|
636
|
+
// Focus first item in submenu
|
|
637
|
+
if (submenuItems.length > 0) {
|
|
638
|
+
const firstItem = submenuItems[0]
|
|
639
|
+
firstItem.setAttribute('tabindex', '0')
|
|
640
|
+
firstItem.focus()
|
|
641
|
+
this.lastHoveredItem = firstItem
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// Close current submenu and return focus to parent trigger
|
|
647
|
+
// Returns true if a submenu was closed, false if we're at top level
|
|
648
|
+
closeCurrentSubmenuWithKeyboard(focusedElement) {
|
|
649
|
+
// Find the item with tabindex="0" (current item) instead of using focusedElement
|
|
650
|
+
const allItems = this.element.querySelectorAll('[role="menuitem"]')
|
|
651
|
+
const currentItem = Array.from(allItems).find(item => item.getAttribute('tabindex') === '0')
|
|
652
|
+
|
|
653
|
+
if (!currentItem) return false
|
|
654
|
+
|
|
655
|
+
// Find the closest parent menu (the menu containing the current item)
|
|
656
|
+
const parentMenu = currentItem.closest('[role="menu"]')
|
|
657
|
+
if (!parentMenu) return false
|
|
658
|
+
|
|
659
|
+
// Check if this menu is a submenu (has data-side="right" or "right-start")
|
|
660
|
+
const dataSide = parentMenu.getAttribute('data-side')
|
|
661
|
+
if (dataSide === 'right' || dataSide === 'right-start') {
|
|
662
|
+
// Find the trigger that opened this submenu
|
|
663
|
+
const trigger = parentMenu.previousElementSibling
|
|
664
|
+
|
|
665
|
+
// Close this submenu and all its children using utility
|
|
666
|
+
closeSubmenu(parentMenu, trigger)
|
|
667
|
+
|
|
668
|
+
// Return focus to the trigger
|
|
669
|
+
if (trigger) {
|
|
670
|
+
// Find the parent menu of the trigger to get all items in that level
|
|
671
|
+
const triggerParentMenu = trigger.closest('[role="menu"]')
|
|
672
|
+
if (triggerParentMenu) {
|
|
673
|
+
// Get all items in the trigger's menu level
|
|
674
|
+
const parentMenuItems = []
|
|
675
|
+
Array.from(triggerParentMenu.children).forEach(child => {
|
|
676
|
+
if (child.hasAttribute('role') && child.getAttribute('role') === 'menuitem') {
|
|
677
|
+
parentMenuItems.push(child)
|
|
678
|
+
} else if (child.classList && child.classList.contains('relative')) {
|
|
679
|
+
const itemTrigger = child.querySelector(':scope > [role="menuitem"]')
|
|
680
|
+
if (itemTrigger) {
|
|
681
|
+
parentMenuItems.push(itemTrigger)
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
})
|
|
685
|
+
|
|
686
|
+
// Set tabindex on all items in parent menu
|
|
687
|
+
parentMenuItems.forEach(item => {
|
|
688
|
+
item.setAttribute('tabindex', '-1')
|
|
689
|
+
})
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// Set focus on the trigger
|
|
693
|
+
trigger.setAttribute('tabindex', '0')
|
|
694
|
+
trigger.focus()
|
|
695
|
+
this.lastHoveredItem = trigger
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
return true
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return false
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
// Handle navigation within command items
|
|
705
|
+
handleCommandNavigation(event, commandElement) {
|
|
706
|
+
event.preventDefault()
|
|
707
|
+
|
|
708
|
+
const allOptions = Array.from(commandElement.querySelectorAll('[role="option"]:not([data-hidden])'))
|
|
709
|
+
const currentOption = allOptions.find(opt => opt.getAttribute('data-focused') === 'true')
|
|
710
|
+
let currentIndex = currentOption ? allOptions.indexOf(currentOption) : -1
|
|
711
|
+
|
|
712
|
+
if (event.key === 'ArrowDown') {
|
|
713
|
+
currentIndex = currentIndex < allOptions.length - 1 ? currentIndex + 1 : 0
|
|
714
|
+
} else if (event.key === 'ArrowUp') {
|
|
715
|
+
currentIndex = currentIndex > 0 ? currentIndex - 1 : allOptions.length - 1
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// Remove focus from all options
|
|
719
|
+
allOptions.forEach(opt => {
|
|
720
|
+
opt.removeAttribute('data-focused')
|
|
721
|
+
opt.classList.remove('bg-accent', 'text-accent-foreground')
|
|
722
|
+
})
|
|
723
|
+
|
|
724
|
+
// Add focus to new option
|
|
725
|
+
if (allOptions[currentIndex]) {
|
|
726
|
+
allOptions[currentIndex].setAttribute('data-focused', 'true')
|
|
727
|
+
allOptions[currentIndex].classList.add('bg-accent', 'text-accent-foreground')
|
|
728
|
+
allOptions[currentIndex].scrollIntoView({ block: 'nearest', behavior: 'smooth' })
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// Close command submenu and return to parent menu
|
|
733
|
+
closeCommandSubmenu(commandElement) {
|
|
734
|
+
const submenu = commandElement.closest('[role="menu"][data-side="right"], [role="menu"][data-side="right-start"]')
|
|
735
|
+
if (!submenu) return false
|
|
736
|
+
|
|
737
|
+
const trigger = submenu.previousElementSibling
|
|
738
|
+
if (!trigger || trigger.getAttribute('role') !== 'menuitem') return false
|
|
739
|
+
|
|
740
|
+
// Clear data-focused from all command options to prevent them from interfering with main menu navigation
|
|
741
|
+
const allCommandOptions = commandElement.querySelectorAll('[role="option"]')
|
|
742
|
+
allCommandOptions.forEach(option => {
|
|
743
|
+
option.removeAttribute('data-focused')
|
|
744
|
+
option.classList.remove('bg-accent', 'text-accent-foreground')
|
|
745
|
+
})
|
|
746
|
+
|
|
747
|
+
// Close the submenu using utility
|
|
748
|
+
closeSubmenu(submenu, trigger)
|
|
749
|
+
|
|
750
|
+
// Find parent menu and its items
|
|
751
|
+
const parentMenu = trigger.closest('[role="menu"]')
|
|
752
|
+
if (parentMenu) {
|
|
753
|
+
const parentItems = []
|
|
754
|
+
Array.from(parentMenu.children).forEach(child => {
|
|
755
|
+
if (child.hasAttribute('role') && child.getAttribute('role') === 'menuitem') {
|
|
756
|
+
parentItems.push(child)
|
|
757
|
+
} else if (child.classList && child.classList.contains('relative')) {
|
|
758
|
+
const itemTrigger = child.querySelector(':scope > [role="menuitem"]')
|
|
759
|
+
if (itemTrigger) {
|
|
760
|
+
parentItems.push(itemTrigger)
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
})
|
|
764
|
+
|
|
765
|
+
// Set tabindex on all parent items
|
|
766
|
+
parentItems.forEach(item => {
|
|
767
|
+
item.setAttribute('tabindex', '-1')
|
|
768
|
+
})
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// Return focus to trigger
|
|
772
|
+
trigger.setAttribute('tabindex', '0')
|
|
773
|
+
trigger.focus()
|
|
774
|
+
this.lastHoveredItem = trigger
|
|
775
|
+
|
|
776
|
+
return true
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
positionDropdown() {
|
|
780
|
+
// Get trigger and content elements
|
|
781
|
+
const trigger = this.hasTriggerTarget ? this.triggerTarget : this.element
|
|
782
|
+
const content = this.hasContentTarget ? this.contentTarget : this.menuTarget
|
|
783
|
+
|
|
784
|
+
if (!trigger || !content) return
|
|
785
|
+
|
|
786
|
+
// Cleanup previous auto-update if exists
|
|
787
|
+
if (this.cleanup) {
|
|
788
|
+
this.cleanup()
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// Setup middleware for Floating UI
|
|
792
|
+
const middleware = []
|
|
793
|
+
|
|
794
|
+
// Always add offset if specified
|
|
795
|
+
if (this.offsetValue > 0) {
|
|
796
|
+
middleware.push(offset(this.offsetValue))
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// Add flip to automatically adjust placement when overflowing (if enabled)
|
|
800
|
+
if (this.flipValue) {
|
|
801
|
+
middleware.push(flip())
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// Add shift to keep dropdown in viewport
|
|
805
|
+
middleware.push(shift({ padding: 8 }))
|
|
806
|
+
|
|
807
|
+
// Set trigger width CSS variable for dropdown content sizing
|
|
808
|
+
content.style.setProperty('--ui-dropdown-menu-trigger-width', `${trigger.offsetWidth}px`)
|
|
809
|
+
|
|
810
|
+
// Define update function
|
|
811
|
+
const update = () => {
|
|
812
|
+
computePosition(trigger, content, {
|
|
813
|
+
placement: this.placementValue,
|
|
814
|
+
middleware: middleware,
|
|
815
|
+
strategy: this.strategyValue
|
|
816
|
+
}).then(({ x, y, placement, middlewareData }) => {
|
|
817
|
+
// Update trigger width in case it changed
|
|
818
|
+
content.style.setProperty('--ui-dropdown-menu-trigger-width', `${trigger.offsetWidth}px`)
|
|
819
|
+
|
|
820
|
+
Object.assign(content.style, {
|
|
821
|
+
position: this.strategyValue,
|
|
822
|
+
left: `${x}px`,
|
|
823
|
+
top: `${y}px`,
|
|
824
|
+
})
|
|
825
|
+
|
|
826
|
+
// Update data-side attribute for CSS styling
|
|
827
|
+
const side = placement.split('-')[0]
|
|
828
|
+
content.setAttribute('data-side', side)
|
|
829
|
+
|
|
830
|
+
// Update data-align attribute for CSS styling
|
|
831
|
+
const align = placement.split('-')[1] || 'center'
|
|
832
|
+
content.setAttribute('data-align', align)
|
|
833
|
+
})
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// Use autoUpdate to keep position synchronized
|
|
837
|
+
this.cleanup = autoUpdate(
|
|
838
|
+
trigger,
|
|
839
|
+
content,
|
|
840
|
+
update,
|
|
841
|
+
{
|
|
842
|
+
ancestorScroll: true,
|
|
843
|
+
ancestorResize: true,
|
|
844
|
+
elementResize: true,
|
|
845
|
+
layoutShift: true,
|
|
846
|
+
animationFrame: true
|
|
847
|
+
}
|
|
848
|
+
)
|
|
849
|
+
}
|
|
850
|
+
}
|