shadcn_phlexcomponents 0.1.0 → 0.1.1

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.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/tailwind/choices.css +324 -0
  3. data/app/assets/tailwind/vanilla-calendar-pro.css +5 -0
  4. data/app/javascript/controllers/combobox_controller.js +19 -276
  5. data/app/javascript/controllers/date_picker_controller.js +118 -0
  6. data/app/javascript/controllers/date_range_picker_controller.js +231 -0
  7. data/app/javascript/controllers/dropdown_menu_controller.js +1 -1
  8. data/app/javascript/controllers/hover_card_controller.js +33 -126
  9. data/app/javascript/controllers/sidebar_controller.js +0 -1
  10. data/app/javascript/controllers/tooltip_controller.js +32 -126
  11. data/lib/components/accordion.rb +3 -3
  12. data/lib/components/accordion_content.rb +12 -10
  13. data/lib/components/accordion_item.rb +3 -3
  14. data/lib/components/accordion_trigger.rb +3 -3
  15. data/lib/components/alert_description.rb +1 -1
  16. data/lib/components/alert_dialog.rb +2 -2
  17. data/lib/components/alert_dialog_action.rb +2 -2
  18. data/lib/components/alert_dialog_action_to.rb +5 -2
  19. data/lib/components/alert_dialog_cancel.rb +1 -1
  20. data/lib/components/alert_dialog_content.rb +1 -1
  21. data/lib/components/alert_dialog_description.rb +1 -1
  22. data/lib/components/alert_dialog_footer.rb +1 -1
  23. data/lib/components/alert_dialog_header.rb +1 -1
  24. data/lib/components/alert_dialog_title.rb +1 -1
  25. data/lib/components/alert_dialog_trigger.rb +2 -2
  26. data/lib/components/aspect_ratio.rb +1 -1
  27. data/lib/components/avatar.rb +1 -1
  28. data/lib/components/avatar_fallback.rb +1 -1
  29. data/lib/components/avatar_image.rb +1 -2
  30. data/lib/components/badge.rb +2 -8
  31. data/lib/components/base.rb +5 -5
  32. data/lib/components/breadcrumb.rb +1 -1
  33. data/lib/components/breadcrumb_ellipsis.rb +1 -1
  34. data/lib/components/breadcrumb_item.rb +1 -1
  35. data/lib/components/breadcrumb_link.rb +1 -1
  36. data/lib/components/breadcrumb_page.rb +1 -1
  37. data/lib/components/breadcrumb_separator.rb +1 -1
  38. data/lib/components/button.rb +1 -1
  39. data/lib/components/card.rb +1 -1
  40. data/lib/components/card_content.rb +1 -1
  41. data/lib/components/card_description.rb +1 -1
  42. data/lib/components/card_footer.rb +1 -1
  43. data/lib/components/card_header.rb +1 -1
  44. data/lib/components/card_title.rb +1 -1
  45. data/lib/components/checkbox.rb +14 -10
  46. data/lib/components/checkbox_group.rb +9 -8
  47. data/lib/components/collapsible.rb +2 -3
  48. data/lib/components/collapsible_content.rb +2 -3
  49. data/lib/components/collapsible_trigger.rb +5 -5
  50. data/lib/components/combobox.rb +57 -0
  51. data/lib/components/combobox_item.rb +9 -0
  52. data/lib/components/date_picker.rb +94 -0
  53. data/lib/components/date_range_picker.rb +113 -0
  54. data/lib/components/dialog.rb +1 -1
  55. data/lib/components/dialog_close.rb +1 -1
  56. data/lib/components/dialog_content.rb +2 -2
  57. data/lib/components/dialog_description.rb +1 -1
  58. data/lib/components/dialog_footer.rb +1 -1
  59. data/lib/components/dialog_header.rb +1 -1
  60. data/lib/components/dialog_title.rb +1 -1
  61. data/lib/components/dialog_trigger.rb +2 -2
  62. data/lib/components/dropdown_menu.rb +5 -5
  63. data/lib/components/dropdown_menu_content.rb +12 -9
  64. data/lib/components/dropdown_menu_item.rb +5 -6
  65. data/lib/components/dropdown_menu_item_to.rb +6 -3
  66. data/lib/components/dropdown_menu_label.rb +2 -3
  67. data/lib/components/dropdown_menu_separator.rb +5 -5
  68. data/lib/components/dropdown_menu_trigger.rb +9 -10
  69. data/lib/components/hover_card.rb +6 -6
  70. data/lib/components/hover_card_content.rb +8 -12
  71. data/lib/components/hover_card_trigger.rb +5 -11
  72. data/lib/components/input.rb +1 -1
  73. data/lib/components/label.rb +1 -2
  74. data/lib/components/link.rb +5 -2
  75. data/lib/components/loading_button.rb +1 -1
  76. data/lib/components/pagination.rb +4 -4
  77. data/lib/components/pagination_ellipsis.rb +3 -3
  78. data/lib/components/pagination_link.rb +5 -5
  79. data/lib/components/pagination_next.rb +5 -5
  80. data/lib/components/pagination_previous.rb +4 -4
  81. data/lib/components/popover.rb +6 -7
  82. data/lib/components/popover_content.rb +13 -10
  83. data/lib/components/popover_trigger.rb +5 -6
  84. data/lib/components/progress.rb +7 -7
  85. data/lib/components/radio_group.rb +4 -4
  86. data/lib/components/radio_group_item.rb +8 -8
  87. data/lib/components/select.rb +67 -72
  88. data/lib/components/select_content.rb +12 -7
  89. data/lib/components/select_group.rb +3 -3
  90. data/lib/components/select_item.rb +9 -8
  91. data/lib/components/select_label.rb +6 -5
  92. data/lib/components/select_trigger.rb +12 -10
  93. data/lib/components/separator.rb +3 -3
  94. data/lib/components/sheet.rb +9 -9
  95. data/lib/components/sheet_close.rb +4 -4
  96. data/lib/components/sheet_content.rb +13 -15
  97. data/lib/components/sheet_description.rb +3 -3
  98. data/lib/components/sheet_footer.rb +2 -2
  99. data/lib/components/sheet_header.rb +2 -2
  100. data/lib/components/sheet_title.rb +3 -3
  101. data/lib/components/sheet_trigger.rb +6 -6
  102. data/lib/components/sidebar.rb +30 -25
  103. data/lib/components/sidebar_container.rb +1 -1
  104. data/lib/components/sidebar_content.rb +1 -1
  105. data/lib/components/sidebar_footer.rb +2 -2
  106. data/lib/components/sidebar_group.rb +1 -1
  107. data/lib/components/sidebar_group_content.rb +1 -1
  108. data/lib/components/sidebar_group_label.rb +2 -2
  109. data/lib/components/sidebar_header.rb +2 -2
  110. data/lib/components/sidebar_inset.rb +1 -1
  111. data/lib/components/sidebar_menu.rb +2 -2
  112. data/lib/components/sidebar_menu_button.rb +5 -5
  113. data/lib/components/sidebar_menu_item.rb +1 -1
  114. data/lib/components/sidebar_menu_sub.rb +2 -2
  115. data/lib/components/sidebar_menu_sub_button.rb +7 -7
  116. data/lib/components/sidebar_menu_sub_item.rb +1 -1
  117. data/lib/components/sidebar_trigger.rb +5 -5
  118. data/lib/components/skeleton.rb +2 -2
  119. data/lib/components/switch.rb +10 -9
  120. data/lib/components/table.rb +7 -5
  121. data/lib/components/table_body.rb +2 -2
  122. data/lib/components/table_caption.rb +2 -2
  123. data/lib/components/table_cell.rb +2 -2
  124. data/lib/components/table_footer.rb +2 -2
  125. data/lib/components/table_head.rb +3 -3
  126. data/lib/components/table_header.rb +2 -2
  127. data/lib/components/table_row.rb +2 -2
  128. data/lib/components/tabs.rb +3 -3
  129. data/lib/components/tabs_content.rb +5 -5
  130. data/lib/components/tabs_list.rb +4 -4
  131. data/lib/components/tabs_trigger.rb +3 -3
  132. data/lib/components/textarea.rb +1 -1
  133. data/lib/components/theme_switcher.rb +2 -2
  134. data/lib/components/toast.rb +15 -14
  135. data/lib/components/toast_action.rb +5 -4
  136. data/lib/components/toast_action_to.rb +5 -2
  137. data/lib/components/toast_container.rb +5 -5
  138. data/lib/components/toast_content.rb +1 -1
  139. data/lib/components/toast_description.rb +1 -1
  140. data/lib/components/toast_title.rb +1 -1
  141. data/lib/components/tooltip.rb +8 -8
  142. data/lib/components/tooltip_content.rb +8 -11
  143. data/lib/components/tooltip_trigger.rb +9 -11
  144. data/lib/shadcn_phlexcomponents/alias.rb +3 -1
  145. data/lib/shadcn_phlexcomponents/version.rb +1 -1
  146. metadata +9 -4
  147. data/app/javascript/controllers/datepicker_controller.js +0 -47
  148. data/lib/components/datepicker.rb +0 -38
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SelectItem < Base
5
- STYLES = <<~HEREDOC.freeze
5
+ STYLES = <<~HEREDOC
6
6
  group/item relative flex w-full cursor-default select-none items-center
7
7
  rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent
8
- focus:text-accent-foreground data-[disabled]:pointer-events-none
8
+ focus:text-accent-foreground data-[disabled]:pointer-events-none#{" "}
9
9
  data-[disabled]:opacity-50
10
10
  HEREDOC
11
11
 
@@ -21,9 +21,10 @@ module ShadcnPhlexcomponents
21
21
  def view_template(&)
22
22
  div(**@attributes) do
23
23
  span(id: @aria_labelledby, &)
24
-
24
+
25
25
  unless @hide_icon
26
- span(class: "absolute right-2 h-3.5 w-3.5 items-center hidden justify-center group-aria-[selected=true]/item:flex") do
26
+ span(class: "absolute right-2 h-3.5 w-3.5 items-center hidden justify-center
27
+ group-aria-[selected=true]/item:flex") do
27
28
  icon("check", class: "size-4")
28
29
  end
29
30
  end
@@ -36,7 +37,7 @@ module ShadcnPhlexcomponents
36
37
  tabindex: -1,
37
38
  aria: {
38
39
  selected: false,
39
- labelledby: @aria_labelledby
40
+ labelledby: @aria_labelledby,
40
41
  },
41
42
  data: {
42
43
  disabled: @disabled,
@@ -50,9 +51,9 @@ module ShadcnPhlexcomponents
50
51
  mouseover->shadcn-phlexcomponents--select#focusItem
51
52
  mouseout->shadcn-phlexcomponents--select#focusContent
52
53
  HEREDOC
53
- "shadcn-phlexcomponents--select-target": "item"
54
- }
54
+ "shadcn-phlexcomponents--select-target": "item",
55
+ },
55
56
  }
56
57
  end
57
58
  end
58
- end
59
+ end
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module ShadcnPhlexcomponents
3
4
  class SelectLabel < Base
4
- STYLES = "px-2 py-1.5 text-sm font-semibold".freeze
5
+ STYLES = "px-2 py-1.5 text-sm font-semibold"
5
6
 
6
7
  def initialize(aria_id: nil, **attributes)
7
8
  @aria_id = aria_id
8
9
  super(**attributes)
9
10
  end
10
-
11
+
11
12
  def view_template(&)
12
13
  div(**@attributes, &)
13
14
  end
@@ -15,9 +16,9 @@ module ShadcnPhlexcomponents
15
16
  def default_attributes
16
17
  {
17
18
  data: {
18
- "shadcn-phlexcomponents--select-target": "label"
19
- }
19
+ "shadcn-phlexcomponents--select-target": "label",
20
+ },
20
21
  }
21
22
  end
22
23
  end
23
- end
24
+ end
@@ -2,9 +2,9 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SelectTrigger < Base
5
- STYLES = <<~HEREDOC.freeze
5
+ STYLES = <<~HEREDOC
6
6
  flex h-9 items-center justify-between whitespace-nowrap rounded-md border
7
- border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background
7
+ border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background#{" "}
8
8
  data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1
9
9
  focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1
10
10
  w-full cursor-pointer
@@ -21,7 +21,9 @@ module ShadcnPhlexcomponents
21
21
 
22
22
  def view_template
23
23
  button(**@attributes) do
24
- span(class: "pointer-events-none", data: { "shadcn-phlexcomponents--select-target": "triggerText" }) { @value || @placeholder }
24
+ span(class: "pointer-events-none", data: { "shadcn-phlexcomponents--select-target": "triggerText" }) do
25
+ @value || @placeholder
26
+ end
25
27
 
26
28
  icon("chevron-down", class: "size-4 opacity-50")
27
29
  end
@@ -36,19 +38,19 @@ module ShadcnPhlexcomponents
36
38
  aria: {
37
39
  autocomplete: "none",
38
40
  expanded: false,
39
- controls: "#{@aria_id}-content"
41
+ controls: "#{@aria_id}-content",
40
42
  },
41
43
  data: {
42
44
  placeholder: @placeholder.present?,
43
45
  placeholder_text: @placeholder,
44
46
  action: <<~HEREDOC,
45
- click->shadcn-phlexcomponents--select#toggle
46
- keydown.down->shadcn-phlexcomponents--select#toggle:prevent
47
- keydown.up->shadcn-phlexcomponents--select#toggle:prevent
47
+ click->shadcn-phlexcomponents--select#toggle
48
+ keydown.down->shadcn-phlexcomponents--select#toggle:prevent
49
+ keydown.up->shadcn-phlexcomponents--select#toggle:prevent
48
50
  HEREDOC
49
- "shadcn-phlexcomponents--select-target": "trigger"
50
- }
51
+ "shadcn-phlexcomponents--select-target": "trigger",
52
+ },
51
53
  }
52
54
  end
53
55
  end
54
- end
56
+ end
@@ -13,12 +13,12 @@ module ShadcnPhlexcomponents
13
13
  end
14
14
 
15
15
  def default_styles
16
- "#{ORIENTATIONS[@orientation]}"
16
+ ORIENTATIONS[@orientation].to_s
17
17
  end
18
18
 
19
19
  def default_attributes
20
20
  {
21
- role: "none"
21
+ role: "none",
22
22
  }
23
23
  end
24
24
 
@@ -26,4 +26,4 @@ module ShadcnPhlexcomponents
26
26
  div(**@attributes)
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class Sheet < Base
5
- STYLES = "inline-block".freeze
5
+ STYLES = "inline-block"
6
6
 
7
7
  def initialize(side: :right, aria_id: "sheet-#{SecureRandom.hex(5)}", **attributes)
8
8
  @side = side
@@ -15,7 +15,7 @@ module ShadcnPhlexcomponents
15
15
  end
16
16
 
17
17
  def content(**attributes, &)
18
- SheetContent(side: @side, aria_id: @aria_id, **attributes, &)
18
+ SheetContent(side: @side, aria_id: @aria_id, **attributes, &)
19
19
  end
20
20
 
21
21
  def header(**attributes, &)
@@ -23,19 +23,19 @@ module ShadcnPhlexcomponents
23
23
  end
24
24
 
25
25
  def title(**attributes, &)
26
- SheetTitle(aria_id: @aria_id, **attributes, &)
26
+ SheetTitle(aria_id: @aria_id, **attributes, &)
27
27
  end
28
28
 
29
29
  def description(**attributes, &)
30
- SheetDescription(aria_id: @aria_id, **attributes, &)
30
+ SheetDescription(aria_id: @aria_id, **attributes, &)
31
31
  end
32
32
 
33
33
  def footer(**attributes, &)
34
- SheetFooter(**attributes, &)
34
+ SheetFooter(**attributes, &)
35
35
  end
36
36
 
37
37
  def close(**attributes, &)
38
- SheetClose(**attributes, &)
38
+ SheetClose(**attributes, &)
39
39
  end
40
40
 
41
41
  def view_template(&)
@@ -45,9 +45,9 @@ module ShadcnPhlexcomponents
45
45
  def default_attributes
46
46
  {
47
47
  data: {
48
- controller: "shadcn-phlexcomponents--sheet"
49
- }
48
+ controller: "shadcn-phlexcomponents--sheet",
49
+ },
50
50
  }
51
51
  end
52
52
  end
53
- end
53
+ end
@@ -22,7 +22,7 @@ module ShadcnPhlexcomponents
22
22
  merged_attributes.delete(:role)
23
23
  end
24
24
 
25
- send(element.name, **merged_attributes) do
25
+ send(element.name, **merged_attributes) do
26
26
  sanitize_as_child(element.children.to_s)
27
27
  end
28
28
  else
@@ -34,9 +34,9 @@ module ShadcnPhlexcomponents
34
34
  {
35
35
  role: "button",
36
36
  data: {
37
- action: "click->shadcn-phlexcomponents--sheet#close"
38
- }
37
+ action: "click->shadcn-phlexcomponents--sheet#close",
38
+ },
39
39
  }
40
40
  end
41
41
  end
42
- end
42
+ end
@@ -1,15 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShadcnPhlexcomponents
4
-
5
4
  class SheetContent < Base
6
- STYLES = <<~HEREDOC.freeze
5
+ STYLES = <<~HEREDOC
7
6
  fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out
8
7
  data-[state=closed]:duration-300 data-[state=open]:duration-500
9
8
  data-[state=open]:animate-in data-[state=closed]:animate-out
10
9
  HEREDOC
11
10
 
12
- CLOSE_BUTTON_STYLES = <<~HEREDOC.freeze
11
+ CLOSE_BUTTON_STYLES = <<~HEREDOC
13
12
  absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background
14
13
  transition-opacity hover:opacity-100 focus:outline-none focus:ring-2
15
14
  focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none
@@ -17,16 +16,15 @@ module ShadcnPhlexcomponents
17
16
  HEREDOC
18
17
 
19
18
  SIDES = {
20
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
21
- right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
19
+ left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left
20
+ data-[state=open]:slide-in-from-left sm:max-w-sm",
21
+ right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right
22
+ data-[state=open]:slide-in-from-right sm:max-w-sm",
22
23
  top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
23
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"
24
+ bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom
25
+ data-[state=open]:slide-in-from-bottom",
24
26
  }
25
27
 
26
- def self.default_styles(side)
27
- "#{STYLES} #{SIDES[side]}"
28
- end
29
-
30
28
  def initialize(side: :right, aria_id: nil, **attributes)
31
29
  @side = side
32
30
  @aria_id = aria_id
@@ -44,7 +42,7 @@ module ShadcnPhlexcomponents
44
42
  end
45
43
  end
46
44
  end
47
-
45
+
48
46
  def default_attributes
49
47
  {
50
48
  id: "#{@aria_id}-content",
@@ -55,13 +53,13 @@ module ShadcnPhlexcomponents
55
53
  labelledby: "#{@aria_id}-title",
56
54
  },
57
55
  data: {
58
- "shadcn-phlexcomponents--sheet-target": "content"
59
- }
56
+ "shadcn-phlexcomponents--sheet-target": "content",
57
+ },
60
58
  }
61
59
  end
62
60
 
63
61
  def default_styles
64
- self.class.default_styles(@side)
62
+ "#{STYLES} #{SIDES[@side]}"
65
63
  end
66
64
  end
67
- end
65
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SheetDescription < Base
5
- STYLES = "text-sm text-muted-foreground".freeze
5
+ STYLES = "text-sm text-muted-foreground"
6
6
 
7
7
  def initialize(aria_id: nil, **attributes)
8
8
  @aria_id = aria_id
@@ -11,7 +11,7 @@ module ShadcnPhlexcomponents
11
11
 
12
12
  def default_attributes
13
13
  {
14
- id: "#{@aria_id}-description"
14
+ id: "#{@aria_id}-description",
15
15
  }
16
16
  end
17
17
 
@@ -19,4 +19,4 @@ module ShadcnPhlexcomponents
19
19
  p(**@attributes, &)
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SheetFooter < Base
5
- STYLES = "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2".freeze
5
+ STYLES = "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2"
6
6
 
7
7
  def view_template(&)
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SheetHeader < Base
5
- STYLES = "flex flex-col space-y-2 text-center sm:text-left".freeze
5
+ STYLES = "flex flex-col space-y-2 text-center sm:text-left"
6
6
 
7
7
  def view_template(&)
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SheetTitle < Base
5
- STYLES = "text-lg font-semibold text-foreground".freeze
5
+ STYLES = "text-lg font-semibold text-foreground"
6
6
 
7
7
  def initialize(aria_id: nil, **attributes)
8
8
  @aria_id = aria_id
@@ -11,7 +11,7 @@ module ShadcnPhlexcomponents
11
11
 
12
12
  def default_attributes
13
13
  {
14
- id: "#{@aria_id}-title"
14
+ id: "#{@aria_id}-title",
15
15
  }
16
16
  end
17
17
 
@@ -19,4 +19,4 @@ module ShadcnPhlexcomponents
19
19
  h2(**@attributes, &)
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -22,8 +22,8 @@ module ShadcnPhlexcomponents
22
22
  if element.name == "button"
23
23
  merged_attributes.delete(:role)
24
24
  end
25
-
26
- send(element.name, **merged_attributes) do
25
+
26
+ send(element.name, **merged_attributes) do
27
27
  sanitize_as_child(element.children.to_s)
28
28
  end
29
29
  else
@@ -37,14 +37,14 @@ module ShadcnPhlexcomponents
37
37
  aria: {
38
38
  haspopup: "dialog",
39
39
  expanded: false,
40
- controls: "#{@aria_id}-content"
40
+ controls: "#{@aria_id}-content",
41
41
  },
42
42
  data: {
43
43
  as_child: @as_child.to_s,
44
44
  action: "click->shadcn-phlexcomponents--sheet#open",
45
- "shadcn-phlexcomponents--sheet-target": "trigger"
46
- }
45
+ "shadcn-phlexcomponents--sheet-target": "trigger",
46
+ },
47
47
  }
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -11,7 +11,7 @@ module ShadcnPhlexcomponents
11
11
  PANEL_STYLES = {
12
12
  sidebar: "group-data-[side=left]:border-r group-data-[side=right]:border-l",
13
13
  floating: "p-2",
14
- inset: "p-2"
14
+ inset: "p-2",
15
15
  }
16
16
 
17
17
  def initialize(id:, variant: :sidebar, side: :left, width: "16rem", expanded: true, **attributes)
@@ -46,11 +46,11 @@ module ShadcnPhlexcomponents
46
46
  def menu(**attributes, &)
47
47
  SidebarMenu(**attributes, &)
48
48
  end
49
-
49
+
50
50
  def menu_item(**attributes, &)
51
51
  SidebarMenuItem(**attributes, &)
52
52
  end
53
-
53
+
54
54
  def menu_button(**attributes, &)
55
55
  SidebarMenuButton(**attributes, &)
56
56
  end
@@ -58,11 +58,11 @@ module ShadcnPhlexcomponents
58
58
  def menu_sub(**attributes, &)
59
59
  SidebarMenuSub(**attributes, &)
60
60
  end
61
-
61
+
62
62
  def menu_sub_item(**attributes, &)
63
63
  SidebarMenuSubItem(**attributes, &)
64
64
  end
65
-
65
+
66
66
  def menu_sub_button(**attributes, &)
67
67
  SidebarMenuSubButton(**attributes, &)
68
68
  end
@@ -72,32 +72,37 @@ module ShadcnPhlexcomponents
72
72
  end
73
73
 
74
74
  def view_template(&)
75
- div(id: @id,
76
- class: "group peer hidden md:block",
77
- style: { "--sidebar-width": @width },
78
- data: {
79
- side: @side,
80
- variant: @variant,
81
- collapsible: @expanded ? "" : "offcanvas",
82
- sidebar_id: @sidebar_id,
83
- state: @expanded ? "expanded" : "collapsed",
84
- controller: "shadcn-phlexcomponents--sidebar"
85
- }) do
86
- div(class: "relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200
75
+ div(
76
+ id: @id,
77
+ class: "group peer hidden md:block",
78
+ style: { "--sidebar-width": @width },
79
+ data: {
80
+ side: @side,
81
+ variant: @variant,
82
+ collapsible: @expanded ? "" : "offcanvas",
83
+ sidebar_id: @sidebar_id,
84
+ state: @expanded ? "expanded" : "collapsed",
85
+ controller: "shadcn-phlexcomponents--sidebar",
86
+ },
87
+ ) do
88
+ div(
89
+ class: "relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200
87
90
  ease-linear group-data-[collapsible=offcanvas]:w-0 group-data-[side=right]:rotate-180
88
- group-data-[collapsible=icon]:w-[--sidebar-width-icon]", data: { "shadcn-phlexcomponents--sidebar-target": "panelOffset" })
89
-
91
+ group-data-[collapsible=icon]:w-[--sidebar-width-icon]",
92
+ data: { "shadcn-phlexcomponents--sidebar-target": "panelOffset" },
93
+ )
90
94
 
91
- div(class: "fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200
95
+ div(
96
+ class: "fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200
92
97
  ease-linear md:flex left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]
93
98
  group-data-[collapsible=icon]:w-[--sidebar-width-icon] #{PANEL_STYLES[@variant]}",
94
- data: {
95
- "shadcn-phlexcomponents--sidebar-target": "panel"
96
- }) do
97
-
99
+ data: {
100
+ "shadcn-phlexcomponents--sidebar-target": "panel",
101
+ },
102
+ ) do
98
103
  div(**@attributes, &)
99
104
  end
100
105
  end
101
106
  end
102
107
  end
103
- end
108
+ end
@@ -8,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SidebarFooter < Base
5
- STYLES = "flex flex-col gap-2 p-2".freeze
5
+ STYLES = "flex flex-col gap-2 p-2"
6
6
 
7
7
  def view_template(&)
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,9 +8,9 @@ module ShadcnPhlexcomponents
8
8
  duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0
9
9
  group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0
10
10
  HEREDOC
11
-
11
+
12
12
  def view_template(&)
13
13
  div(**@attributes, &)
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SidebarHeader < Base
5
- STYLES = "flex flex-col gap-2 p-2".freeze
5
+ STYLES = "flex flex-col gap-2 p-2"
6
6
 
7
7
  def view_template(&)
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -12,4 +12,4 @@ module ShadcnPhlexcomponents
12
12
  main(**@attributes, &)
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SidebarMenu < Base
5
- STYLES = "flex w-full min-w-0 flex-col gap-1".freeze
5
+ STYLES = "flex w-full min-w-0 flex-col gap-1"
6
6
 
7
7
  def view_template(&)
8
8
  ul(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -30,9 +30,9 @@ module ShadcnPhlexcomponents
30
30
  def default_attributes
31
31
  {
32
32
  data: {
33
- active: @active.to_s
34
- }
35
- }
33
+ active: @active.to_s,
34
+ },
35
+ }
36
36
  end
37
37
 
38
38
  def default_styles
@@ -50,7 +50,7 @@ module ShadcnPhlexcomponents
50
50
  merged_attributes = mix(@attributes, element_attributes)
51
51
  merged_attributes[:class] = styles
52
52
 
53
- send(element.name, **merged_attributes) do
53
+ send(element.name, **merged_attributes) do
54
54
  sanitize_as_child(element.children.to_s)
55
55
  end
56
56
  else
@@ -58,4 +58,4 @@ module ShadcnPhlexcomponents
58
58
  end
59
59
  end
60
60
  end
61
- end
61
+ end
@@ -6,4 +6,4 @@ module ShadcnPhlexcomponents
6
6
  li(**@attributes, &)
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -4,11 +4,11 @@ module ShadcnPhlexcomponents
4
4
  class SidebarMenuSub < Base
5
5
  STYLES = <<~HEREDOC
6
6
  border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col
7
- gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden
7
+ gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden#{" "}
8
8
  HEREDOC
9
9
 
10
10
  def view_template(&)
11
11
  ul(**@attributes, &)
12
12
  end
13
13
  end
14
- end
14
+ end