Class: ShadcnPhlexcomponents::Sheet

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/sheet.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(open: false, **attributes) ⇒ Sheet

Returns a new instance of Sheet.



14
15
16
17
18
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 14

def initialize(open: false, **attributes)
  @open = open
  @aria_id = "sheet-#{SecureRandom.hex(5)}"
  super(**attributes)
end

Instance Method Details

#close(**attributes) ⇒ Object



44
45
46
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 44

def close(**attributes, &)
  SheetClose(**attributes, &)
end

#content(**attributes) ⇒ Object



24
25
26
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 24

def content(**attributes, &)
  SheetContent(aria_id: @aria_id, **attributes, &)
end

#default_attributesObject



48
49
50
51
52
53
54
55
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 48

def default_attributes
  {
    data: {
      controller: "dialog",
      dialog_is_open_value: @open.to_s,
    },
  }
end

#description(**attributes) ⇒ Object



36
37
38
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 36

def description(**attributes, &)
  SheetDescription(aria_id: @aria_id, **attributes, &)
end


40
41
42
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 40

def footer(**attributes, &)
  SheetFooter(**attributes, &)
end

#header(**attributes) ⇒ Object



28
29
30
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 28

def header(**attributes, &)
  SheetHeader(**attributes, &)
end

#title(**attributes) ⇒ Object



32
33
34
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 32

def title(**attributes, &)
  SheetTitle(aria_id: @aria_id, **attributes, &)
end

#trigger(**attributes) ⇒ Object



20
21
22
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 20

def trigger(**attributes, &)
  SheetTrigger(aria_id: @aria_id, **attributes, &)
end

#view_templateObject



57
58
59
60
61
62
63
# File 'lib/shadcn_phlexcomponents/components/sheet.rb', line 57

def view_template(&)
  div(**@attributes) do
    overlay("dialog")

    yield
  end
end