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,945 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
import { setState } from "../utils/state-manager.js"
|
|
3
|
+
import { lockScroll, unlockScroll } from "../utils/scroll-lock-manager.js"
|
|
4
|
+
import { onEscapeKey } from "../utils/escape-key-manager.js"
|
|
5
|
+
import { focusFirstElement } from "../utils/focus-trap-manager.js"
|
|
6
|
+
|
|
7
|
+
// Drawer controller for gesture-based mobile-first drawers
|
|
8
|
+
// Based on Vaul (https://vaul.emilkowal.ski)
|
|
9
|
+
//
|
|
10
|
+
// Features:
|
|
11
|
+
// - Drag-to-close with velocity detection
|
|
12
|
+
// - Four directions: bottom, top, left, right
|
|
13
|
+
// - Snap points support
|
|
14
|
+
// - Modal and non-modal modes
|
|
15
|
+
// - Handle-only dragging
|
|
16
|
+
// - Input repositioning for mobile keyboards
|
|
17
|
+
export default class extends Controller {
|
|
18
|
+
static targets = ["container", "overlay", "content", "handle"]
|
|
19
|
+
static values = {
|
|
20
|
+
open: { type: Boolean, default: false },
|
|
21
|
+
direction: { type: String, default: "bottom" },
|
|
22
|
+
dismissible: { type: Boolean, default: true },
|
|
23
|
+
modal: { type: Boolean, default: true },
|
|
24
|
+
snapPoints: { type: Array, default: [] },
|
|
25
|
+
activeSnapPoint: { type: Number, default: -1 },
|
|
26
|
+
fadeFromIndex: { type: Number, default: -1 },
|
|
27
|
+
snapToSequentialPoint: { type: Boolean, default: false },
|
|
28
|
+
handleOnly: { type: Boolean, default: false },
|
|
29
|
+
repositionInputs: { type: Boolean, default: true }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Constants from Vaul
|
|
33
|
+
TRANSITIONS = {
|
|
34
|
+
DURATION: 0.65, // 650ms - increased from Vaul's 500ms for smoother perceived closing
|
|
35
|
+
EASE: [0.32, 0.72, 0, 1] // Same easing for all animations (from Vaul original)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
VELOCITY_THRESHOLD = 0.4 // px/ms - high velocity triggers immediate close/snap
|
|
39
|
+
CLOSE_THRESHOLD = 0.25 // 25% of drawer height/width
|
|
40
|
+
DRAG_CLASS = "vaul-dragging"
|
|
41
|
+
SCROLL_LOCK_TIMEOUT = 500 // ms
|
|
42
|
+
|
|
43
|
+
connect() {
|
|
44
|
+
this.isPointerDown = false
|
|
45
|
+
this.pointerStart = null
|
|
46
|
+
this.dragStartTime = null
|
|
47
|
+
this.isDragging = false
|
|
48
|
+
this.lastPositions = [] // For velocity calculation
|
|
49
|
+
this.lastScrollTime = 0
|
|
50
|
+
this.hasBeenOpened = false
|
|
51
|
+
this.dragStartY = 0 // Initial Y position when drag starts (for snap points)
|
|
52
|
+
|
|
53
|
+
// Setup resize observer for snap point recalculation
|
|
54
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
55
|
+
this.handleResize()
|
|
56
|
+
})
|
|
57
|
+
if (this.hasContentTarget) {
|
|
58
|
+
this.resizeObserver.observe(this.contentTarget)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (this.openValue) {
|
|
62
|
+
this.show()
|
|
63
|
+
} else {
|
|
64
|
+
// Set initial closed state
|
|
65
|
+
this.setAllTargetsState("closed")
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Setup viewport resize handler for input repositioning
|
|
69
|
+
if (this.repositionInputsValue && typeof visualViewport !== "undefined") {
|
|
70
|
+
this.viewportResizeHandler = this.handleViewportResize.bind(this)
|
|
71
|
+
visualViewport.addEventListener("resize", this.viewportResizeHandler)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
disconnect() {
|
|
76
|
+
unlockScroll()
|
|
77
|
+
this.cleanupEscapeHandler()
|
|
78
|
+
if (this.preventScrollHandler) {
|
|
79
|
+
document.removeEventListener("touchmove", this.preventScrollHandler)
|
|
80
|
+
}
|
|
81
|
+
if (this.viewportResizeHandler && typeof visualViewport !== "undefined") {
|
|
82
|
+
visualViewport.removeEventListener("resize", this.viewportResizeHandler)
|
|
83
|
+
}
|
|
84
|
+
if (this.resizeObserver) {
|
|
85
|
+
this.resizeObserver.disconnect()
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ============================================================================
|
|
90
|
+
// PUBLIC ACTIONS
|
|
91
|
+
// ============================================================================
|
|
92
|
+
|
|
93
|
+
open() {
|
|
94
|
+
this.openValue = true
|
|
95
|
+
this.show()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
close() {
|
|
99
|
+
if (!this.dismissibleValue) return
|
|
100
|
+
this.openValue = false
|
|
101
|
+
this.hide()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
closeOnOverlayClick(event) {
|
|
105
|
+
if (this.dismissibleValue && this.modalValue) {
|
|
106
|
+
this.animateToClosedPosition()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// POINTER EVENT HANDLERS
|
|
112
|
+
// ============================================================================
|
|
113
|
+
|
|
114
|
+
handlePointerDown(event) {
|
|
115
|
+
// Ignore if handle-only mode and not dragging from handle
|
|
116
|
+
if (this.handleOnlyValue && !this.isHandleEvent(event)) {
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Check for opt-outs
|
|
121
|
+
if (this.shouldIgnoreDrag(event)) {
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this.isPointerDown = true
|
|
126
|
+
this.pointerStart = this.getPointerPosition(event)
|
|
127
|
+
this.dragStartTime = Date.now()
|
|
128
|
+
this.lastPositions = [{
|
|
129
|
+
position: this.pointerStart,
|
|
130
|
+
time: this.dragStartTime
|
|
131
|
+
}]
|
|
132
|
+
|
|
133
|
+
// Capture pointer for smooth drag
|
|
134
|
+
if (this.hasContentTarget) {
|
|
135
|
+
this.contentTarget.setPointerCapture(event.pointerId)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
handlePointerMove(event) {
|
|
140
|
+
if (!this.isPointerDown) return
|
|
141
|
+
|
|
142
|
+
const currentPos = this.getPointerPosition(event)
|
|
143
|
+
const delta = this.getDelta(this.pointerStart, currentPos)
|
|
144
|
+
|
|
145
|
+
// Check if drag threshold exceeded
|
|
146
|
+
if (!this.isDragging) {
|
|
147
|
+
const threshold = event.pointerType === "touch" ? 10 : 2
|
|
148
|
+
if (Math.abs(delta) > threshold) {
|
|
149
|
+
this.startDrag()
|
|
150
|
+
} else {
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Update velocity tracking
|
|
156
|
+
const now = Date.now()
|
|
157
|
+
this.lastPositions.push({ position: currentPos, time: now })
|
|
158
|
+
// Keep only last 5 positions for velocity calculation
|
|
159
|
+
if (this.lastPositions.length > 5) {
|
|
160
|
+
this.lastPositions.shift()
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Apply damping for opposite-direction drags
|
|
164
|
+
const dampedDelta = this.applyDamping(delta)
|
|
165
|
+
|
|
166
|
+
// Update transform
|
|
167
|
+
this.updateTransform(dampedDelta)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
handlePointerUp(event) {
|
|
171
|
+
if (!this.isPointerDown) return
|
|
172
|
+
|
|
173
|
+
this.isPointerDown = false
|
|
174
|
+
|
|
175
|
+
if (this.hasContentTarget) {
|
|
176
|
+
this.contentTarget.releasePointerCapture(event.pointerId)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!this.isDragging) return
|
|
180
|
+
|
|
181
|
+
// Calculate velocity
|
|
182
|
+
const velocity = this.calculateVelocity()
|
|
183
|
+
const currentPos = this.getPointerPosition(event)
|
|
184
|
+
const delta = this.getDelta(this.pointerStart, currentPos)
|
|
185
|
+
const dampedDelta = this.applyDamping(delta)
|
|
186
|
+
|
|
187
|
+
this.endDrag(dampedDelta, velocity)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
handlePointerCancel(event) {
|
|
191
|
+
this.handlePointerUp(event)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// ============================================================================
|
|
195
|
+
// DRAG LOGIC
|
|
196
|
+
// ============================================================================
|
|
197
|
+
|
|
198
|
+
startDrag() {
|
|
199
|
+
this.isDragging = true
|
|
200
|
+
this.hasBeenOpened = true
|
|
201
|
+
|
|
202
|
+
// Capture current drawer position for snap points
|
|
203
|
+
// When drawer is at a snap point, we need to maintain that position as the base
|
|
204
|
+
if (this.snapPointsValue && this.snapPointsValue.length > 0 && this.activeSnapPointValue >= 0) {
|
|
205
|
+
this.dragStartY = this.getSnapPointY(this.activeSnapPointValue)
|
|
206
|
+
} else {
|
|
207
|
+
this.dragStartY = 0
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Add dragging class and clear any inline transitions
|
|
211
|
+
if (this.hasContentTarget) {
|
|
212
|
+
this.contentTarget.classList.add(this.DRAG_CLASS)
|
|
213
|
+
// Clear any inline transition from previous snap/animations
|
|
214
|
+
// This ensures smooth dragging without interference
|
|
215
|
+
this.contentTarget.style.transition = "none"
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Dispatch drag start event
|
|
219
|
+
this.dispatchEvent("drawer:drag:start", { direction: this.directionValue })
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
updateTransform(delta) {
|
|
223
|
+
if (!this.hasContentTarget) return
|
|
224
|
+
|
|
225
|
+
// For snap points: add delta to the initial position
|
|
226
|
+
// This ensures smooth dragging from the current snap point
|
|
227
|
+
let finalDelta = delta
|
|
228
|
+
if (this.snapPointsValue && this.snapPointsValue.length > 0) {
|
|
229
|
+
finalDelta = this.dragStartY + delta
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Vaul approach: During drag, apply the calculated position
|
|
233
|
+
const transform = this.getTransformForDirection(finalDelta)
|
|
234
|
+
this.contentTarget.style.transform = transform
|
|
235
|
+
|
|
236
|
+
// Update overlay opacity based on current position
|
|
237
|
+
this.updateOverlayOpacity(finalDelta)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
endDrag(delta, velocity) {
|
|
241
|
+
this.isDragging = false
|
|
242
|
+
|
|
243
|
+
// Remove dragging class to re-enable transitions
|
|
244
|
+
if (this.hasContentTarget) {
|
|
245
|
+
this.contentTarget.classList.remove(this.DRAG_CLASS)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// For snap points: calculate final position (initial + delta)
|
|
249
|
+
let finalDelta = delta
|
|
250
|
+
if (this.snapPointsValue && this.snapPointsValue.length > 0) {
|
|
251
|
+
finalDelta = this.dragStartY + delta
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Decide: close, snap, or return to current position
|
|
255
|
+
if (this.snapPointsValue.length > 0) {
|
|
256
|
+
this.handleSnapPointRelease(finalDelta, velocity)
|
|
257
|
+
} else {
|
|
258
|
+
this.handleRegularRelease(delta, velocity)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Dispatch drag end event
|
|
262
|
+
this.dispatchEvent("drawer:drag:end", {
|
|
263
|
+
direction: this.directionValue,
|
|
264
|
+
velocity,
|
|
265
|
+
delta: finalDelta
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// ============================================================================
|
|
270
|
+
// SNAP POINTS
|
|
271
|
+
// ============================================================================
|
|
272
|
+
|
|
273
|
+
// Convert snap point index to Y position (in pixels)
|
|
274
|
+
// This is how Vaul does it - simple Y positions, no complex offsets
|
|
275
|
+
getSnapPointY(snapIndex) {
|
|
276
|
+
if (!this.snapPointsValue || snapIndex < 0 || snapIndex >= this.snapPointsValue.length) {
|
|
277
|
+
return 0
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const snapPoint = this.snapPointsValue[snapIndex]
|
|
281
|
+
const containerSize = this.getContainerSizeForSnapPoint(snapPoint)
|
|
282
|
+
|
|
283
|
+
if (containerSize === 0) return 0
|
|
284
|
+
|
|
285
|
+
const pixels = this.snapPointToPixels(snapPoint, containerSize)
|
|
286
|
+
|
|
287
|
+
return this.calculateSnapPosition(snapPoint, pixels, containerSize)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
getContainerSizeForSnapPoint(snapPoint) {
|
|
291
|
+
// For mobile Safari: subtract threshold to account for browser UI
|
|
292
|
+
const MOBILE_THRESHOLD = 80
|
|
293
|
+
|
|
294
|
+
if (this.isHorizontalDirection()) {
|
|
295
|
+
return window.innerWidth
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// For 100% snap point: use viewport - threshold to keep handle accessible
|
|
299
|
+
return snapPoint === 1
|
|
300
|
+
? window.innerHeight - MOBILE_THRESHOLD
|
|
301
|
+
: window.innerHeight
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
snapPointToPixels(snapPoint, containerSize) {
|
|
305
|
+
if (typeof snapPoint === 'string' && snapPoint.includes('px')) {
|
|
306
|
+
return parseInt(snapPoint)
|
|
307
|
+
}
|
|
308
|
+
if (snapPoint > 1) {
|
|
309
|
+
// Percentage (1-100)
|
|
310
|
+
return (snapPoint / 100) * containerSize
|
|
311
|
+
}
|
|
312
|
+
// Decimal percentage (0-1)
|
|
313
|
+
return snapPoint * containerSize
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
calculateSnapPosition(snapPoint, pixels, containerSize) {
|
|
317
|
+
const MOBILE_THRESHOLD = 80
|
|
318
|
+
const isClosingSide = this.directionValue === 'bottom' || this.directionValue === 'right'
|
|
319
|
+
|
|
320
|
+
if (isClosingSide) {
|
|
321
|
+
// Special case for 100% snap point: position at threshold
|
|
322
|
+
if (snapPoint === 1) return MOBILE_THRESHOLD
|
|
323
|
+
return containerSize - pixels
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return pixels
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
handleSnapPointRelease(delta, velocity) {
|
|
330
|
+
if (!this.snapPointsValue || this.snapPointsValue.length === 0) {
|
|
331
|
+
// No snap points configured
|
|
332
|
+
this.close()
|
|
333
|
+
return
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const currentIndex = this.activeSnapPointValue >= 0 ? this.activeSnapPointValue : 0
|
|
337
|
+
const currentY = delta
|
|
338
|
+
|
|
339
|
+
// If at first snap point and dragging in closing direction
|
|
340
|
+
if (currentIndex === 0 && this.isClosingDirection(delta)) {
|
|
341
|
+
const firstSnapY = this.getSnapPointY(0)
|
|
342
|
+
|
|
343
|
+
// Only close if dragged significantly beyond the first snap point
|
|
344
|
+
// Check if current position is past the first snap point in closing direction
|
|
345
|
+
const isDraggedBeyondFirstSnap = this.directionValue === "bottom" || this.directionValue === "right"
|
|
346
|
+
? currentY > firstSnapY // For bottom/right, Y increases when closing
|
|
347
|
+
: currentY < firstSnapY // For top/left, Y decreases when closing
|
|
348
|
+
|
|
349
|
+
if (isDraggedBeyondFirstSnap) {
|
|
350
|
+
// Animate from current position to closed position
|
|
351
|
+
this.animateToClosedPosition()
|
|
352
|
+
return
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Vaul approach: currentY is just the delta (drawer's current Y position)
|
|
357
|
+
let targetIndex
|
|
358
|
+
|
|
359
|
+
// High velocity - skip to next/previous snap point
|
|
360
|
+
if (Math.abs(velocity) > this.VELOCITY_THRESHOLD && !this.snapToSequentialPointValue) {
|
|
361
|
+
// Use VELOCITY to determine direction of movement, not delta
|
|
362
|
+
// Positive velocity = moving in closing direction
|
|
363
|
+
// Negative velocity = moving in opening direction
|
|
364
|
+
if (velocity > 0) {
|
|
365
|
+
// Moving toward closed - go to previous snap point (lower index = more closed)
|
|
366
|
+
targetIndex = Math.max(currentIndex - 1, 0)
|
|
367
|
+
} else {
|
|
368
|
+
// Moving toward open - go to next snap point (higher index = more open)
|
|
369
|
+
targetIndex = Math.min(currentIndex + 1, this.snapPointsValue.length - 1)
|
|
370
|
+
}
|
|
371
|
+
} else {
|
|
372
|
+
// Low velocity - find closest snap point based on Y position
|
|
373
|
+
targetIndex = this.findClosestSnapPointIndex(currentY)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
this.snapTo(targetIndex)
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
handleRegularRelease(delta, velocity) {
|
|
380
|
+
const drawerSize = this.getDrawerSize()
|
|
381
|
+
const dragPercentage = Math.abs(delta) / drawerSize
|
|
382
|
+
|
|
383
|
+
// High velocity in closing direction - immediate close
|
|
384
|
+
if (Math.abs(velocity) > this.VELOCITY_THRESHOLD && this.isClosingDirection(delta)) {
|
|
385
|
+
this.close()
|
|
386
|
+
return
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Low velocity - use distance threshold
|
|
390
|
+
if (dragPercentage > this.CLOSE_THRESHOLD && this.isClosingDirection(delta)) {
|
|
391
|
+
this.close()
|
|
392
|
+
} else {
|
|
393
|
+
// Return to open position
|
|
394
|
+
this.resetPosition()
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
findClosestSnapPointIndex(currentY) {
|
|
399
|
+
if (!this.snapPointsValue || this.snapPointsValue.length === 0) return 0
|
|
400
|
+
|
|
401
|
+
let closestIndex = 0
|
|
402
|
+
let closestDistance = Infinity
|
|
403
|
+
|
|
404
|
+
this.snapPointsValue.forEach((_, index) => {
|
|
405
|
+
const snapY = this.getSnapPointY(index)
|
|
406
|
+
const distance = Math.abs(currentY - snapY)
|
|
407
|
+
|
|
408
|
+
if (distance < closestDistance) {
|
|
409
|
+
closestDistance = distance
|
|
410
|
+
closestIndex = index
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
return closestIndex
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
snapTo(snapPointIndex, animated = true) {
|
|
418
|
+
if (snapPointIndex < 0 || snapPointIndex >= this.snapPointsValue.length) {
|
|
419
|
+
return
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
this.activeSnapPointValue = snapPointIndex
|
|
423
|
+
const snapPoint = this.snapPointsValue[snapPointIndex]
|
|
424
|
+
const snapY = this.getSnapPointY(snapPointIndex)
|
|
425
|
+
|
|
426
|
+
// Update transform to snap position
|
|
427
|
+
if (this.hasContentTarget) {
|
|
428
|
+
this.applyTransform(this.getTransformForSnapPoint(snapY), animated)
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Update overlay opacity based on snap point
|
|
432
|
+
this.updateOverlayOpacityForSnapPoint(snapPointIndex)
|
|
433
|
+
|
|
434
|
+
// Dispatch snap event
|
|
435
|
+
this.dispatchEvent("drawer:snap", { snapPoint, snapPointIndex, y: snapY })
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
snapPointToPercentage(snapPoint) {
|
|
439
|
+
if (snapPoint === 1) return 1 // Fully open
|
|
440
|
+
if (typeof snapPoint === "number" && snapPoint < 1) return snapPoint // 0-1 percentage
|
|
441
|
+
|
|
442
|
+
// Pixel value - convert to percentage
|
|
443
|
+
const drawerSize = this.getDrawerSize()
|
|
444
|
+
const pixels = parseInt(snapPoint)
|
|
445
|
+
return Math.min(pixels / drawerSize, 1)
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// ============================================================================
|
|
449
|
+
// DIRECTION SUPPORT
|
|
450
|
+
// ============================================================================
|
|
451
|
+
|
|
452
|
+
// Get transform for snap point (uses pre-calculated offset)
|
|
453
|
+
getTransformForSnapPoint(offset) {
|
|
454
|
+
switch (this.directionValue) {
|
|
455
|
+
case "bottom":
|
|
456
|
+
return `translate3d(0, ${offset}px, 0)`
|
|
457
|
+
case "top":
|
|
458
|
+
return `translate3d(0, ${-offset}px, 0)`
|
|
459
|
+
case "left":
|
|
460
|
+
return `translate3d(${-offset}px, 0, 0)`
|
|
461
|
+
case "right":
|
|
462
|
+
return `translate3d(${offset}px, 0, 0)`
|
|
463
|
+
default:
|
|
464
|
+
return `translate3d(0, ${offset}px, 0)`
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Get transform for drag delta (during drag)
|
|
469
|
+
getTransformForDirection(delta) {
|
|
470
|
+
switch (this.directionValue) {
|
|
471
|
+
case "bottom":
|
|
472
|
+
return `translate3d(0, ${delta}px, 0)`
|
|
473
|
+
case "top":
|
|
474
|
+
return `translate3d(0, ${-delta}px, 0)`
|
|
475
|
+
case "left":
|
|
476
|
+
return `translate3d(${-delta}px, 0, 0)`
|
|
477
|
+
case "right":
|
|
478
|
+
return `translate3d(${delta}px, 0, 0)`
|
|
479
|
+
default:
|
|
480
|
+
return `translate3d(0, ${delta}px, 0)`
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
isHorizontalDirection() {
|
|
485
|
+
return this.directionValue === "left" || this.directionValue === "right"
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
isVerticalDirection() {
|
|
489
|
+
return this.directionValue === "bottom" || this.directionValue === "top"
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
getDelta(start, current) {
|
|
493
|
+
// Calculate delta in the direction of drawer movement
|
|
494
|
+
// Positive delta = closing direction, negative = opening direction
|
|
495
|
+
if (this.isHorizontalDirection()) {
|
|
496
|
+
// left: drag left (start.x - current.x) = closing
|
|
497
|
+
// right: drag right (current.x - start.x) = closing
|
|
498
|
+
return this.directionValue === "left"
|
|
499
|
+
? start.x - current.x
|
|
500
|
+
: current.x - start.x
|
|
501
|
+
}
|
|
502
|
+
// bottom: drag down (current.y - start.y) = closing
|
|
503
|
+
// top: drag up (start.y - current.y) = closing
|
|
504
|
+
return this.directionValue === "top"
|
|
505
|
+
? start.y - current.y
|
|
506
|
+
: current.y - start.y
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
isClosingDirection(delta) {
|
|
510
|
+
// Positive delta means closing direction
|
|
511
|
+
return delta > 0
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
getDrawerSize() {
|
|
515
|
+
if (!this.hasContentTarget) return 0
|
|
516
|
+
|
|
517
|
+
return this.isHorizontalDirection()
|
|
518
|
+
? this.contentTarget.offsetWidth
|
|
519
|
+
: this.contentTarget.offsetHeight
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
getViewportSize() {
|
|
523
|
+
return this.isHorizontalDirection()
|
|
524
|
+
? window.innerWidth
|
|
525
|
+
: window.innerHeight
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
getClosedPosition() {
|
|
529
|
+
// Return position that's completely off-screen
|
|
530
|
+
// Viewport size + drawer size ensures it's fully hidden
|
|
531
|
+
return this.getViewportSize() + this.getDrawerSize()
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// ============================================================================
|
|
535
|
+
// VELOCITY CALCULATION
|
|
536
|
+
// ============================================================================
|
|
537
|
+
|
|
538
|
+
calculateVelocity() {
|
|
539
|
+
if (this.lastPositions.length < 2) return 0
|
|
540
|
+
|
|
541
|
+
const latest = this.lastPositions[this.lastPositions.length - 1]
|
|
542
|
+
const earliest = this.lastPositions[0]
|
|
543
|
+
|
|
544
|
+
const timeDelta = latest.time - earliest.time
|
|
545
|
+
if (timeDelta === 0) return 0
|
|
546
|
+
|
|
547
|
+
const positionDelta = this.getDelta(earliest.position, latest.position)
|
|
548
|
+
|
|
549
|
+
// Velocity in px/ms
|
|
550
|
+
return positionDelta / timeDelta
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// ============================================================================
|
|
554
|
+
// DAMPING
|
|
555
|
+
// ============================================================================
|
|
556
|
+
|
|
557
|
+
applyDamping(delta) {
|
|
558
|
+
// NO damping when using snap points - drawer should move freely between all snap points
|
|
559
|
+
if (this.snapPointsValue && this.snapPointsValue.length > 0) {
|
|
560
|
+
return delta
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// Only apply damping for opposite-direction drags (trying to open more than fully open)
|
|
564
|
+
if (!this.isClosingDirection(delta)) {
|
|
565
|
+
// Apply constant 10% resistance (elastic boundary effect)
|
|
566
|
+
// This creates a strong rubber band effect when trying to open beyond fully open
|
|
567
|
+
return delta * 0.1
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
return delta
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// ============================================================================
|
|
574
|
+
// HELPERS
|
|
575
|
+
// ============================================================================
|
|
576
|
+
|
|
577
|
+
getPointerPosition(event) {
|
|
578
|
+
return {
|
|
579
|
+
x: event.clientX,
|
|
580
|
+
y: event.clientY
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
shouldIgnoreDrag(event) {
|
|
585
|
+
// Check if text is selected
|
|
586
|
+
const selection = window.getSelection()
|
|
587
|
+
if (selection && selection.toString().length > 0) {
|
|
588
|
+
return true
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// Check for data-vaul-no-drag attribute
|
|
592
|
+
if (event.target.closest("[data-vaul-no-drag]")) {
|
|
593
|
+
return true
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// Check if over scrollable content (and not at scroll top/bottom)
|
|
597
|
+
const scrollableEl = event.target.closest("[data-vaul-scrollable]")
|
|
598
|
+
if (scrollableEl) {
|
|
599
|
+
const now = Date.now()
|
|
600
|
+
if (now - this.lastScrollTime < this.SCROLL_LOCK_TIMEOUT) {
|
|
601
|
+
return true
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
if (this.isVerticalDirection()) {
|
|
605
|
+
const canScrollUp = scrollableEl.scrollTop > 0
|
|
606
|
+
const canScrollDown = scrollableEl.scrollTop < scrollableEl.scrollHeight - scrollableEl.clientHeight
|
|
607
|
+
|
|
608
|
+
if (canScrollUp || canScrollDown) {
|
|
609
|
+
return true
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
return false
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
isHandleEvent(event) {
|
|
618
|
+
if (!this.hasHandleTarget) return false
|
|
619
|
+
return event.target === this.handleTarget || this.handleTarget.contains(event.target)
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
resetPosition() {
|
|
623
|
+
if (!this.hasContentTarget) return
|
|
624
|
+
// Animate back to open position
|
|
625
|
+
this.applyTransform("translate3d(0, 0, 0)", true, true)
|
|
626
|
+
this.updateOverlayOpacity(0)
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// ============================================================================
|
|
630
|
+
// OVERLAY OPACITY
|
|
631
|
+
// ============================================================================
|
|
632
|
+
|
|
633
|
+
getFadeIndex() {
|
|
634
|
+
return this.fadeFromIndexValue >= 0 ? this.fadeFromIndexValue : 0
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
updateOverlayOpacity(currentY) {
|
|
638
|
+
if (!this.hasOverlayTarget || !this.hasSnapPoints()) return
|
|
639
|
+
|
|
640
|
+
const fadeIndex = this.getFadeIndex()
|
|
641
|
+
const fadeStartY = this.getSnapPointY(fadeIndex)
|
|
642
|
+
const fadeEndIndex = Math.min(fadeIndex + 1, this.snapPointsValue.length - 1)
|
|
643
|
+
const fadeEndY = this.getSnapPointY(fadeEndIndex)
|
|
644
|
+
|
|
645
|
+
this.setOverlayOpacity(this.calculateOverlayOpacity(currentY, fadeStartY, fadeEndY))
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
updateOverlayOpacityForSnapPoint(snapPointIndex) {
|
|
649
|
+
if (!this.hasOverlayTarget || !this.hasSnapPoints()) return
|
|
650
|
+
|
|
651
|
+
const fadeIndex = this.getFadeIndex()
|
|
652
|
+
const fadeEndIndex = fadeIndex + 1
|
|
653
|
+
|
|
654
|
+
if (snapPointIndex < fadeIndex) {
|
|
655
|
+
this.setOverlayOpacity(0)
|
|
656
|
+
} else if (snapPointIndex >= fadeEndIndex) {
|
|
657
|
+
this.setOverlayOpacity(1)
|
|
658
|
+
} else {
|
|
659
|
+
// AT fadeFromIndex - use Y position for precise opacity
|
|
660
|
+
this.updateOverlayOpacity(this.getSnapPointY(snapPointIndex))
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
calculateOverlayOpacity(currentY, fadeStartY, fadeEndY) {
|
|
665
|
+
// MORE OPEN than fadeEndIndex
|
|
666
|
+
if (currentY < fadeEndY) return 1
|
|
667
|
+
// MORE CLOSED than fadeFromIndex
|
|
668
|
+
if (currentY > fadeStartY) return 0
|
|
669
|
+
// BETWEEN: gradual opacity
|
|
670
|
+
const range = fadeStartY - fadeEndY
|
|
671
|
+
const progress = (fadeStartY - currentY) / range
|
|
672
|
+
return Math.min(1, Math.max(0, progress))
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
setOverlayOpacity(opacity) {
|
|
676
|
+
this.overlayTarget.style.opacity = String(opacity)
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// ============================================================================
|
|
680
|
+
// STATE MANAGEMENT
|
|
681
|
+
// ============================================================================
|
|
682
|
+
|
|
683
|
+
show() {
|
|
684
|
+
// Set data-state to open for animations
|
|
685
|
+
this.setAllTargetsState("open")
|
|
686
|
+
|
|
687
|
+
// If using snap points, position drawer at FIRST snap point (Vaul behavior)
|
|
688
|
+
if (this.hasSnapPoints()) {
|
|
689
|
+
const initialIndex = 0 // Always start at first snap point
|
|
690
|
+
|
|
691
|
+
if (this.hasContentTarget) {
|
|
692
|
+
// Always animate from closed position (both first open and re-opens)
|
|
693
|
+
this.activeSnapPointValue = initialIndex
|
|
694
|
+
this.positionAtClosed()
|
|
695
|
+
this.snapTo(initialIndex, true)
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
this.hasBeenOpened = true
|
|
699
|
+
this.updateOverlayOpacityForSnapPoint(initialIndex)
|
|
700
|
+
} else {
|
|
701
|
+
// No snap points - always animate from closed position to fully open
|
|
702
|
+
if (this.hasContentTarget) {
|
|
703
|
+
this.positionAtClosed()
|
|
704
|
+
this.animateToOpen()
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
this.hasBeenOpened = true
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
// Lock body scroll in modal mode
|
|
711
|
+
if (this.modalValue) {
|
|
712
|
+
lockScroll()
|
|
713
|
+
this.preventScrollHandler = this.handlePreventScroll.bind(this)
|
|
714
|
+
document.addEventListener("touchmove", this.preventScrollHandler, { passive: false })
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// Setup focus trap
|
|
718
|
+
this.setupFocusTrap()
|
|
719
|
+
|
|
720
|
+
// Setup escape key handler
|
|
721
|
+
if (this.dismissibleValue) {
|
|
722
|
+
this.setupEscapeHandler()
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// Dispatch open event
|
|
726
|
+
this.dispatchEvent("drawer:open", { open: true })
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
hide() {
|
|
730
|
+
// Simply delegate to animateToClosedPosition for consistent animation
|
|
731
|
+
this.animateToClosedPosition()
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
animateToClosedPosition() {
|
|
735
|
+
// Animate from current position to closed position, then close
|
|
736
|
+
if (this.hasContentTarget) {
|
|
737
|
+
const closedPosition = this.getClosedPosition()
|
|
738
|
+
|
|
739
|
+
// Apply transition for smooth animation
|
|
740
|
+
this.contentTarget.style.transition = this.getTransitionStyle()
|
|
741
|
+
this.contentTarget.style.transform = this.getTransformForDirection(closedPosition)
|
|
742
|
+
|
|
743
|
+
// Fade out overlay
|
|
744
|
+
if (this.hasOverlayTarget) {
|
|
745
|
+
this.overlayTarget.style.transition = `opacity ${this.TRANSITIONS.DURATION}s`
|
|
746
|
+
this.overlayTarget.style.opacity = "0"
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
// After animation completes, clean up
|
|
750
|
+
setTimeout(() => {
|
|
751
|
+
this.cleanupAfterClose()
|
|
752
|
+
}, this.TRANSITIONS.DURATION * 1000)
|
|
753
|
+
} else {
|
|
754
|
+
// Fallback if no content target
|
|
755
|
+
this.close()
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
cleanupAfterClose() {
|
|
760
|
+
// Clear inline styles and set data-state
|
|
761
|
+
if (this.hasContentTarget) {
|
|
762
|
+
this.contentTarget.style.transition = "none"
|
|
763
|
+
this.contentTarget.style.transform = ""
|
|
764
|
+
}
|
|
765
|
+
if (this.hasOverlayTarget) {
|
|
766
|
+
this.overlayTarget.style.transition = "none"
|
|
767
|
+
this.overlayTarget.style.opacity = ""
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
this.setAllTargetsState("closed")
|
|
771
|
+
this.openValue = false
|
|
772
|
+
|
|
773
|
+
// Unlock body scroll
|
|
774
|
+
unlockScroll()
|
|
775
|
+
|
|
776
|
+
// Remove touch scroll prevention
|
|
777
|
+
if (this.preventScrollHandler) {
|
|
778
|
+
document.removeEventListener("touchmove", this.preventScrollHandler)
|
|
779
|
+
this.preventScrollHandler = null
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// Remove escape handler
|
|
783
|
+
this.cleanupEscapeHandler()
|
|
784
|
+
|
|
785
|
+
// Dispatch close event
|
|
786
|
+
this.dispatchEvent("drawer:close", { open: false })
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
isMobile() {
|
|
790
|
+
// Detect mobile devices to prevent keyboard popup on focus
|
|
791
|
+
return /iPhone|iPad|iPod|Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
setupFocusTrap() {
|
|
795
|
+
if (!this.hasContentTarget) return
|
|
796
|
+
|
|
797
|
+
// On mobile, avoid focusing inputs/textareas to prevent keyboard popup
|
|
798
|
+
focusFirstElement(this.contentTarget, {
|
|
799
|
+
excludeInputsOnMobile: true,
|
|
800
|
+
preventScroll: true
|
|
801
|
+
})
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// ============================================================================
|
|
805
|
+
// ADVANCED FEATURES
|
|
806
|
+
// ============================================================================
|
|
807
|
+
|
|
808
|
+
handleResize() {
|
|
809
|
+
// If drawer is open and using snap points, maintain relative position
|
|
810
|
+
// Y positions are calculated on-demand via getSnapPointY(), no pre-calculation needed
|
|
811
|
+
if (this.openValue && this.snapPointsValue && this.snapPointsValue.length > 0 && this.activeSnapPointValue >= 0) {
|
|
812
|
+
this.snapTo(this.activeSnapPointValue, false)
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
handleViewportResize() {
|
|
817
|
+
// Detect mobile keyboard open/close
|
|
818
|
+
if (!this.hasContentTarget || !this.openValue) return
|
|
819
|
+
|
|
820
|
+
// When keyboard opens, visualViewport height decreases
|
|
821
|
+
// Scroll active input into view
|
|
822
|
+
const activeElement = document.activeElement
|
|
823
|
+
|
|
824
|
+
if (activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA")) {
|
|
825
|
+
setTimeout(() => {
|
|
826
|
+
activeElement.scrollIntoView({ behavior: "smooth", block: "center" })
|
|
827
|
+
}, 100)
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
handlePreventScroll(event) {
|
|
832
|
+
// Allow scroll inside drawer content
|
|
833
|
+
if (!this.hasContentTarget) return
|
|
834
|
+
|
|
835
|
+
// Check if the touch is inside the drawer content
|
|
836
|
+
const target = event.target
|
|
837
|
+
const isInsideDrawer = this.contentTarget.contains(target)
|
|
838
|
+
|
|
839
|
+
if (isInsideDrawer) {
|
|
840
|
+
// Find the nearest scrollable parent
|
|
841
|
+
let scrollableParent = target
|
|
842
|
+
while (scrollableParent && scrollableParent !== this.contentTarget) {
|
|
843
|
+
const overflowY = window.getComputedStyle(scrollableParent).overflowY
|
|
844
|
+
const isScrollable = overflowY === "auto" || overflowY === "scroll"
|
|
845
|
+
|
|
846
|
+
if (isScrollable && scrollableParent.scrollHeight > scrollableParent.clientHeight) {
|
|
847
|
+
// Allow scroll inside this scrollable container
|
|
848
|
+
return
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
scrollableParent = scrollableParent.parentElement
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// Prevent page scroll for everything else
|
|
856
|
+
event.preventDefault()
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// ============================================================================
|
|
860
|
+
// HELPER METHODS
|
|
861
|
+
// ============================================================================
|
|
862
|
+
|
|
863
|
+
setAllTargetsState(state) {
|
|
864
|
+
const isOpen = state === "open"
|
|
865
|
+
|
|
866
|
+
if (this.hasContainerTarget) {
|
|
867
|
+
setState(this.containerTarget, state)
|
|
868
|
+
}
|
|
869
|
+
if (this.hasOverlayTarget) {
|
|
870
|
+
setState(this.overlayTarget, state)
|
|
871
|
+
}
|
|
872
|
+
if (this.hasContentTarget) {
|
|
873
|
+
setState(this.contentTarget, state)
|
|
874
|
+
// Use inert to prevent focus when closed
|
|
875
|
+
this.contentTarget.inert = !isOpen
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
hasSnapPoints() {
|
|
880
|
+
return this.snapPointsValue && this.snapPointsValue.length > 0
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
positionAtClosed() {
|
|
884
|
+
const closedPosition = this.getClosedPosition()
|
|
885
|
+
this.contentTarget.style.transition = "none"
|
|
886
|
+
this.contentTarget.style.transform = this.getTransformForDirection(closedPosition)
|
|
887
|
+
// Force reflow to ensure position is applied
|
|
888
|
+
this.contentTarget.offsetHeight
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
animateToOpen() {
|
|
892
|
+
this.contentTarget.style.transition = this.getTransitionStyle()
|
|
893
|
+
this.contentTarget.style.transform = "translate3d(0, 0, 0)"
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
getTransitionStyle() {
|
|
897
|
+
return `transform ${this.TRANSITIONS.DURATION}s cubic-bezier(${this.TRANSITIONS.EASE.join(',')})`
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
setupEscapeHandler() {
|
|
901
|
+
this.cleanupEscapeHandler()
|
|
902
|
+
this.escapeCleanup = onEscapeKey(() => {
|
|
903
|
+
this.animateToClosedPosition()
|
|
904
|
+
})
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
cleanupEscapeHandler() {
|
|
908
|
+
if (this.escapeCleanup) {
|
|
909
|
+
this.escapeCleanup()
|
|
910
|
+
this.escapeCleanup = null
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
applyTransform(transform, animated = false, clearAfter = false) {
|
|
915
|
+
if (!this.hasContentTarget) return
|
|
916
|
+
|
|
917
|
+
if (animated) {
|
|
918
|
+
this.contentTarget.style.transition = this.getTransitionStyle()
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
this.contentTarget.style.transform = transform
|
|
922
|
+
|
|
923
|
+
if (animated && clearAfter) {
|
|
924
|
+
setTimeout(() => {
|
|
925
|
+
if (this.hasContentTarget) {
|
|
926
|
+
this.contentTarget.style.transition = ""
|
|
927
|
+
this.contentTarget.style.transform = ""
|
|
928
|
+
}
|
|
929
|
+
}, this.TRANSITIONS.DURATION * 1000)
|
|
930
|
+
} else if (animated) {
|
|
931
|
+
setTimeout(() => {
|
|
932
|
+
if (this.hasContentTarget) {
|
|
933
|
+
this.contentTarget.style.transition = ""
|
|
934
|
+
}
|
|
935
|
+
}, this.TRANSITIONS.DURATION * 1000)
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
dispatchEvent(eventName, detail = {}) {
|
|
940
|
+
this.element.dispatchEvent(new CustomEvent(eventName, {
|
|
941
|
+
bubbles: true,
|
|
942
|
+
detail
|
|
943
|
+
}))
|
|
944
|
+
}
|
|
945
|
+
}
|