Class: Ariadne::UI::Dialog::Component
- Inherits:
-
BaseComponent
- Object
- ViewComponentContrib::Base
- BaseComponent
- Ariadne::UI::Dialog::Component
- Defined in:
- app/components/ariadne/ui/dialog/component.rb
Overview
A ‘Dialog` is used to remove the user from the main application flow, to confirm actions, ask for disambiguation or to present small forms.
Constant Summary
Constants inherited from BaseComponent
BaseComponent::ACCEPT_ANYTHING
Constants included from ViewHelper
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Slots collapse
- #describedby ⇒ Object
- #labelledby ⇒ Object
-
#reveal_button ⇒ Object
The button to open the dialog.
-
#reveal_link ⇒ Object
The button to open the dialog.
Methods inherited from BaseComponent
audited_at, #class_for, #component, component_id, #component_id, component_name, generate_id, #html_attributes, i18n_scope, #merge_data_attributes, #merge_tailwind_classes, #options, stimulus_name, translate, #validate_aria_label!
Methods included from AttributesHelper
#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes, #prepend_action, #prepend_controller, #prepend_data_attribute
Methods included from ViewComponent::StyleVariants
Instance Method Details
#describedby ⇒ Object
99 100 101 |
# File 'app/components/ariadne/ui/dialog/component.rb', line 99 def describedby "#{@dialog_id}-description" end |
#labelledby ⇒ Object
95 96 97 |
# File 'app/components/ariadne/ui/dialog/component.rb', line 95 def labelledby "#{@dialog_id}-title" end |
#reveal_button ⇒ Object
The button to open the dialog.
A link to open the dialog.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/components/ariadne/ui/dialog/component.rb', line 44 renders_one :reveal, types: { button: lambda { |**| component_data_attrs = { action: "#{stimulus_name}#open", # Use the component's stimulus_name method } [:html_attrs] ||= {} # Ensure merge_data_attributes helper exists and is used correctly [:html_attrs][:data] = merge_data_attributes(.fetch(:html_attrs, {}), component_data_attrs) Ariadne::UI::Button::Component.new(**) # Pass remaining options }, link: lambda { |**| component_data_attrs = { action: "#{stimulus_name}#open", # Use the component's stimulus_name method } [:html_attrs] ||= {} # Ensure merge_data_attributes helper exists and is used correctly [:html_attrs][:data] = merge_data_attributes(.fetch(:html_attrs, {}), component_data_attrs) Ariadne::UI::Link::Component.new(**) # Pass remaining options }, } |
#reveal_link ⇒ Object
The button to open the dialog.
A link to open the dialog.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/components/ariadne/ui/dialog/component.rb', line 44 renders_one :reveal, types: { button: lambda { |**| component_data_attrs = { action: "#{stimulus_name}#open", # Use the component's stimulus_name method } [:html_attrs] ||= {} # Ensure merge_data_attributes helper exists and is used correctly [:html_attrs][:data] = merge_data_attributes(.fetch(:html_attrs, {}), component_data_attrs) Ariadne::UI::Button::Component.new(**) # Pass remaining options }, link: lambda { |**| component_data_attrs = { action: "#{stimulus_name}#open", # Use the component's stimulus_name method } [:html_attrs] ||= {} # Ensure merge_data_attributes helper exists and is used correctly [:html_attrs][:data] = merge_data_attributes(.fetch(:html_attrs, {}), component_data_attrs) Ariadne::UI::Link::Component.new(**) # Pass remaining options }, } |