Class: ShadcnPhlexcomponents::AlertDialogContent

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/alert_dialog.rb

Constant Summary

Constants inherited from Base

Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from Base

#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

#initialize(aria_id: nil, **attributes) ⇒ AlertDialogContent

Returns a new instance of AlertDialogContent.



129
130
131
132
# File 'lib/shadcn_phlexcomponents/components/alert_dialog.rb', line 129

def initialize(aria_id: nil, **attributes)
  @aria_id = aria_id
  super(**attributes)
end

Instance Method Details

#default_attributes ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/shadcn_phlexcomponents/components/alert_dialog.rb', line 134

def default_attributes
  {
    id: "#{@aria_id}-content",
    tabindex: -1,
    role: "alertdialog",
    aria: {
      describedby: "#{@aria_id}-description",
      labelledby: "#{@aria_id}-title",
    },
    data: {
      state: "closed",
      alert_dialog_target: "content",
    },
  }
end

#view_template ⇒ Object



150
151
152
# File 'lib/shadcn_phlexcomponents/components/alert_dialog.rb', line 150

def view_template(&)
  div(style: { display: "none" }, **@attributes, &)
end